Created
July 15, 2014 08:43
-
-
Save mikecmpbll/b69ee43ce607b0393cc4 to your computer and use it in GitHub Desktop.
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
irb(main):001:0> module Foo | |
irb(main):002:1> def the_var(var) | |
irb(main):003:2> @var ||= var | |
irb(main):004:2> end | |
irb(main):005:1> end | |
=> nil | |
irb(main):006:0> class Bar | |
irb(main):007:1> end | |
=> nil | |
irb(main):008:0> Bar.extend(Foo).the_var("something") | |
=> "something" | |
irb(main):009:0> Bar.extend(Foo).the_var("blah") | |
=> "something" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment