-
-
Save jerryhebert/06b6fcdd3d59d3bdbca0 to your computer and use it in GitHub Desktop.
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
[67] pry(main)> module Foo | |
[67] pry(main)* def self.included(base) | |
[67] pry(main)* pp "Foo got included into #{base}" | |
[67] pry(main)* base.instance_eval do | |
[67] pry(main)* pp "Getting instance-evaluated! #{self}" | |
[67] pry(main)* @x = 5 | |
[67] pry(main)* end | |
[67] pry(main)* end | |
[67] pry(main)* end | |
=> :included | |
[68] pry(main)> | |
[69] pry(main)> class A | |
[69] pry(main)* include Foo | |
[69] pry(main)* end | |
"Foo got included into A" | |
"Getting instance-evaluated! A" | |
=> A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment