Created
June 3, 2012 21:48
-
-
Save alexspeller/2865142 to your computer and use it in GitHub Desktop.
Ruby method scopes
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
def option | |
puts 'hello from option' | |
end |
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
$ ruby two.rb | |
hello from option |
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 './one.rb' | |
class MyClass | |
def initialize | |
option | |
end | |
end | |
MyClass.new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment