Skip to content

Instantly share code, notes, and snippets.

@tsnow
Created October 18, 2012 13:22
Show Gist options
  • Save tsnow/3911786 to your computer and use it in GitHub Desktop.
Save tsnow/3911786 to your computer and use it in GitHub Desktop.
Wait. What?
1.9.3p286 :151 > module P
1.9.3p286 :152?> @@b = 1
1.9.3p286 :153?> end
=> 1
1.9.3p286 :154 > class A
1.9.3p286 :155?> include P
1.9.3p286 :156?> end
=> A
1.9.3p286 :157 > class B
1.9.3p286 :158?> include P
1.9.3p286 :159?> end
=> B
1.9.3p286 :160 > class B
1.9.3p286 :161?> @@b += @@b
1.9.3p286 :162?> end
=> 2
1.9.3p286 :166 > module P
1.9.3p286 :167?> @@b
1.9.3p286 :168?> end
=> 2
1.9.3p286 :169 > module Q
1.9.3p286 :170?> @@b = 4
1.9.3p286 :171?> end
=> 4
1.9.3p286 :172 > class B
1.9.3p286 :173?> include Q
1.9.3p286 :174?> end
=> B
1.9.3p286 :175 > module P
1.9.3p286 :176?> @@b
1.9.3p286 :177?> end
=> 2
1.9.3p286 :178 > class A
1.9.3p286 :179?> @@b
1.9.3p286 :180?> end
=> 2
1.9.3p286 :181 > class B
1.9.3p286 :182?> @@b
1.9.3p286 :183?> end
=> 2
1.9.3p286 :184 > module Q
1.9.3p286 :185?> @@b
1.9.3p286 :186?> end
=> 4
1.9.3p286 :187 >
1.9.3p286 :187 > class C
1.9.3p286 :188?> include Q
1.9.3p286 :189?> include P
1.9.3p286 :190?> end
=> C
1.9.3p286 :191 > class C
1.9.3p286 :192?> @@b
1.9.3p286 :193?> end
=> 4
1.9.3p286 :194 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment