Created
May 13, 2013 15:24
-
-
Save imustardsoft/5569139 to your computer and use it in GitHub Desktop.
module initialize
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/concern' | |
module MyModule | |
def my_val | |
@my_val ||= 2 | |
end | |
# def self.included(receiver) | |
# receiver.instance_variable_set('@my_val',2) | |
# end | |
end | |
class MyClass | |
include MyModule | |
def initialize | |
# super | |
@my_val2= 1 | |
end | |
def what_is_my_val | |
puts my_val | |
puts @my_val2 | |
end | |
end | |
m = MyClass.new | |
#m.bar | |
m.what_is_my_val |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment