Skip to content

Instantly share code, notes, and snippets.

@shunsugai
Created June 3, 2012 12:59
Show Gist options
  • Save shunsugai/2863365 to your computer and use it in GitHub Desktop.
Save shunsugai/2863365 to your computer and use it in GitHub Desktop.
ClassMacro1
class Foo
def self.foo(method)
define_method(method) do
puts "Foo##{method} called."
end
end
foo :bar
foo :baz
end
Foo.new.bar #=> Foo#bar called.
Foo.new.baz #=> Foo#baz called.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment