metaprogramming/refinement.rb
tests/_examples/metaprogramming/refinement.rb in the metorex repository.
module StringExt
refine(String) do
def shout
upcase + "!"
end
end
end
using StringExt
puts "hello".shout
Output:
HELLO!
tests/_examples/metaprogramming/refinement.rb in the metorex repository.
module StringExt
refine(String) do
def shout
upcase + "!"
end
end
end
using StringExt
puts "hello".shout
Output:
HELLO!