Chapter 9: Macros and Metaprogramming
macro define_method(name, content)
def {{name}}
{{content}}
end
end
define_method foo, 1
# This generates:
#
# def foo
# 1
# end
foo # => 1Last updated
macro define_method(name, content)
def {{name}}
{{content}}
end
end
define_method foo, 1
# This generates:
#
# def foo
# 1
# end
foo # => 1Last updated
def foo
1
end