Skip to content

Instantly share code, notes, and snippets.

@porras
Created July 29, 2013 09:00
Show Gist options
  • Select an option

  • Save porras/6103082 to your computer and use it in GitHub Desktop.

Select an option

Save porras/6103082 to your computer and use it in GitHub Desktop.
class FancyDSL
def initialize(&block)
instance_eval(&block)
end
def setup(value)
@setup = value
end
end
f = FancyDSL.new do
setup :wadus
end
puts f.inspect
class Client
def initialize(value)
@value = value
end
def do_something
f = FancyDSL.new do
setup @value
end
puts f.inspect
end
end
c = Client.new(:wadus)
c.do_something
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment