Created
February 9, 2017 10:33
-
-
Save Marahin/21cce19d98c5209911368c58f0d6974b to your computer and use it in GitHub Desktop.
kappa.rb
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
module KappaOne | |
## I want the value of 'test' to be memoized & available in class KappaOneOne and KappaOneTwo | |
def test | |
@test ||= some_timetaking_method | |
end | |
class KappaOneOne | |
def initialize | |
@val = test.to_s | |
end | |
end | |
class KappaOneTwo | |
def initialize | |
@val = test.to_s.first(5) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment