Skip to content

Instantly share code, notes, and snippets.

@0x0dea

0x0dea/ecksit.rb Secret

Created August 2, 2015 22:22
Show Gist options
  • Save 0x0dea/e716f3feb95d7d333368 to your computer and use it in GitHub Desktop.
Save 0x0dea/e716f3feb95d7d333368 to your computer and use it in GitHub Desktop.
class Thing
attr_accessor :foo, :bar
def set_foo x
@foo = x
end
end
def Thing
Thing.new.tap { |t| t.instance_eval(&proc) }
end
t = Thing do |t|
t.foo = 10
t.bar = 20
set_foo 42
end
p t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment