Skip to content

Instantly share code, notes, and snippets.

@simeonwillbanks
Created March 20, 2010 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simeonwillbanks/338901 to your computer and use it in GitHub Desktop.
Save simeonwillbanks/338901 to your computer and use it in GitHub Desktop.
#Ruby Property Accessors Person
class Person
def initialize(first_name, last_name)
@first_name = first_name
@last_name = last_name
end
# access method
def full_name
"%s %s" % [@first_name, @last_name]
end
end
me = Person.new("Simeon", "Willbanks")
# so clean!
puts me.full_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment