Skip to content

Instantly share code, notes, and snippets.

@ryan-allen
Created June 24, 2010 05:55
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 ryan-allen/451041 to your computer and use it in GitHub Desktop.
Save ryan-allen/451041 to your computer and use it in GitHub Desktop.
module TreeFace
def with(object, &block)
raise "need an object" if not object
object.instance_eval(&block)
object
end
end
include TreeFace
sites = with(Array.new) do
push :flashden
push :audiojungle
push(with(Hash.new) do
self[:name] = 'ThemeForest'
self[:url] = 'http://themeforest.net'
self[:top_authors] = with(Array.new) do
push :john
push :ryan
push :glen
end
end)
end
puts sites.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment