Created
April 12, 2017 03:41
-
-
Save niaeashes/895e933718001c400ce6280533d0b53d 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
require 'active_support' | |
module A | |
extend ::ActiveSupport::Concern | |
class_methods do | |
def sample=value | |
@sample = value | |
end | |
def sample | |
@sample | |
end | |
end | |
end | |
class B | |
include A | |
end | |
class C | |
include A | |
end | |
B.sample = "ok" | |
C.sample = "ng" | |
puts B.sample | |
puts C.sample | |
# > ok | |
# > ng |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment