Created
May 1, 2018 11:00
-
-
Save krainboltgreene/eb5cf8331abb76371469e7c0d29234d2 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
[1] pry(main)> module Behavior | |
[1] pry(main)* extend ActiveSupport::Concern | |
[1] pry(main)* | |
[1] pry(main)* included do | |
[1] pry(main)* add(1) | |
[1] pry(main)* end | |
[1] pry(main)* | |
[1] pry(main)* class_methods do | |
[1] pry(main)* def add(value) | |
[1] pry(main)* @value = value | |
[1] pry(main)* end | |
[1] pry(main)* end | |
[1] pry(main)* end | |
=> :add | |
[2] pry(main)> | |
[3] pry(main)> class Parent include Behavior; end | |
=> Parent | |
[4] pry(main)> Parent.instance_variable_get(:@value) | |
=> 1 | |
[5] pry(main)> | |
[6] pry(main)> class Child < Parent; end | |
=> nil | |
[7] pry(main)> Child.instance_variable_get(:@value) | |
=> nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment