Skip to content

Instantly share code, notes, and snippets.

@richo
Created June 6, 2012 07:31
Show Gist options
  • Save richo/2880440 to your computer and use it in GitHub Desktop.
Save richo/2880440 to your computer and use it in GitHub Desktop.
class CachyThing
def intitialize
@_items = {}
end
def method_missing(sym)
# TODO Catch setters
if @_items.include? sym
@_items[sym]
else
@_items[sym] = fetch(sym)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment