Created
January 11, 2016 13:46
-
-
Save JEG2/977d7c287a566b24497a to your computer and use it in GitHub Desktop.
You can call methods higher than their definitions, as long as it's executed before said call.
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
>> class Magic | |
>> def initialize | |
>> self.var = 42 | |
>> puts var | |
>> end | |
>> attr_accessor :var | |
>> end | |
=> nil | |
>> Magic.new | |
42 | |
=> #<Magic:0x007ff9eb8bf398 @var=42> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment