Skip to content

Instantly share code, notes, and snippets.

@nerdEd
Forked from abachman/gist:376701
Created April 23, 2010 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nerdEd/376714 to your computer and use it in GitHub Desktop.
Save nerdEd/376714 to your computer and use it in GitHub Desktop.
# Is this good? Like on a scale of 1 - 10, 1 being, "oh god my eyes the burning I can't even"
# and 10 being, "DO IT MOAR!"
class Document
attr_accessor :foo, :bar
def initialize
if block_given?
yield self
end
end
def identity
"#{ foo } #{ bar }"
end
end
doc = Document.new do |d|
d.foo = "HELLO"
d.bar = "!DLROW".reverse
end
p doc.identity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment