Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
module initialize
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
You can’t perform that action at this time.