Skip to content

Instantly share code, notes, and snippets.

@lsegal
Created December 18, 2009 03:05
Show Gist options
  • Save lsegal/259256 to your computer and use it in GitHub Desktop.
Save lsegal/259256 to your computer and use it in GitHub Desktop.
def MYCLASS(klass, &block)
eval "class #{klass}; end"
eval(klass).instance_eval(&block)
end
def MYDEFINE(meth, &proc)
define_method(meth, &proc)
end
#### Your new DSL: ####
MYCLASS(:MyClass) {
MYDEFINE(:foo) {|a, b=1|
puts "hi"
}
}
MyClass.new.foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment