Macros function
macro define_method(name, content)
puts "before"
def {{name}}
puts {{content}}
end
puts "after"
end
define_method foo, 1
puts "before foo"
foo # => 1
puts "after foo"
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
macro define_method(name, content)
puts "before"
def {{name}}
puts {{content}}
end
puts "after"
end
define_method foo, 1
puts "before foo"
foo # => 1
puts "after foo"