Last active
August 29, 2015 13:56
-
-
Save nogweii/9104855 to your computer and use it in GitHub Desktop.
Example module code for #ruby on Freenode
This file contains hidden or 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
module MyBase | |
def big_function | |
@_memoized_big_function ||= begin | |
load_lots_of_data(SettingsManager.foo_bar) | |
end | |
end | |
module_method :big_function | |
public :big_function | |
end | |
class Chef | |
class Recipe | |
include MyBase | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I had originally asked in #ruby on Freenode:
Which lead me to this StackOverflow question and the result is above.