Skip to content

Instantly share code, notes, and snippets.

@perfectfoolish
Created July 16, 2013 08:38
Show Gist options
  • Save perfectfoolish/6006946 to your computer and use it in GitHub Desktop.
Save perfectfoolish/6006946 to your computer and use it in GitHub Desktop.
class Person
def initialize(name, age)
@name = name
@age = age
end
public # This method can be called from outside the class.
def about_me
puts "I'm #{@name} and I'm #{@age} years old!"
end
private # This method can't!
def bank_account_number
@account_number = 12345
puts "My bank account number is #{@account_number}."
end
end
eric = Person.new("Eric", 26)
eric.about_me
eric.bank_account_number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment