Skip to content

Instantly share code, notes, and snippets.

@ohta-rh
Last active August 29, 2015 14:02
Show Gist options
  • Save ohta-rh/9dbb5340e99c264df8c6 to your computer and use it in GitHub Desktop.
Save ohta-rh/9dbb5340e99c264df8c6 to your computer and use it in GitHub Desktop.
class instance method cached object sample
class Hoge
class << self
def store(identificate: identificate)
hoges[identificate] ||= hoges.store(identificate, Hoge.new)
end
def hoges
@hoges ||= {}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment