Skip to content

Instantly share code, notes, and snippets.

@rpocklin
Created March 6, 2012 02:01
Show Gist options
  • Save rpocklin/1982856 to your computer and use it in GitHub Desktop.
Save rpocklin/1982856 to your computer and use it in GitHub Desktop.
memoizing a class method in ruby
require 'active_support'
## strange this isn't done implicitly
class A
class << self
extend ActiveSupport::Memoizable
def my_class_method(x)
# cool stuff here
end
memoize :my_class_method
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment