Created
March 6, 2012 02:01
-
-
Save rpocklin/1982856 to your computer and use it in GitHub Desktop.
memoizing a class method in ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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