Use with block
suggest changeclass Animal
def method_missing(method, *args, &block)
if method.to_s == 'say'
block.call
else
super
end
end
end
# => Animal.new.say{ 'moo' }
# => "moo"
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents