Skip to content

Instantly share code, notes, and snippets.

@morganp
Created June 11, 2010 22:53
Show Gist options
  • Save morganp/435161 to your computer and use it in GitHub Desktop.
Save morganp/435161 to your computer and use it in GitHub Desktop.
#!/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
@Bodacious
Copy link

Cheers Morgan!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment