Created
June 11, 2010 22:53
-
-
Save morganp/435161 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
#!/usr/bin/env ruby | |
class HelloWorld | |
def initialize | |
@msg = "HelloWorld!" | |
end | |
def to_s | |
return @msg | |
end | |
end | |
#Only execute if called directly | |
#ie other file can require/include and this part will not be executed | |
# $0 calling file (eneterd at command line) | |
# __FILE__ This file | |
if $0 == __FILE__ | |
hi_world = HelloWorld.new | |
puts hi_world | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cheers Morgan!