Skip to content

Instantly share code, notes, and snippets.

@abachman
Created April 23, 2010 15:40
Show Gist options
  • Save abachman/376701 to your computer and use it in GitHub Desktop.
Save abachman/376701 to your computer and use it in GitHub Desktop.
# how bad of form is this?
# Using the scale given at:
# http://docs.google.com/drawings/pub?id=1yAsORHdSy8MZo3Wc9RdtL-yJ_z8YpqRKe1_A1TXkkCA&w=960&h=720
# and in light of ruby best practices.
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