Skip to content

Instantly share code, notes, and snippets.

@imustardsoft
Created May 13, 2013 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imustardsoft/5569139 to your computer and use it in GitHub Desktop.
Save imustardsoft/5569139 to your computer and use it in GitHub Desktop.
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