Skip to content

Instantly share code, notes, and snippets.

@jordanpoulton
Created November 21, 2016 15:13
Show Gist options
  • Save jordanpoulton/ab8f77973688c1c3ec59420064221c84 to your computer and use it in GitHub Desktop.
Save jordanpoulton/ab8f77973688c1c3ec59420064221c84 to your computer and use it in GitHub Desktop.
class Person
def initialize(name, age)
@name = name
@age = age
end
def name
@name
end
def name=(new_name)
@name = new_name
end
end
jordan = Person.new(‘Jordan’, 31)
puts jordan.name # => “Jordan”
jordan.name = “Mr Poulton”
puts jordan.name # => “Mr Poulton”
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment