Skip to content

Instantly share code, notes, and snippets.

@AVGP
Created April 10, 2011 00:27
Show Gist options
  • Save AVGP/911929 to your computer and use it in GitHub Desktop.
Save AVGP/911929 to your computer and use it in GitHub Desktop.
Just a small OOP-Hello-World-alike in Ruby
#!/usr/bin/ruby
class GrussAugust
attr_accessor :name
def initialize(name = "World")
@name = name
end
def greet
if @name.nil?
puts "wtf?"
else
puts "Hello #{@name}!"
end
end
end
tester = GrussAugust.new()
tester.greet()
tester.name = "Marcus"
tester.greet()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment