Skip to content

Instantly share code, notes, and snippets.

@rserur
Created June 2, 2014 18:28
Show Gist options
  • Select an option

  • Save rserur/980d6b54d98d4e5dff69 to your computer and use it in GitHub Desktop.

Select an option

Save rserur/980d6b54d98d4e5dff69 to your computer and use it in GitHub Desktop.
Getters
class Car
def initialize(color, owner, cylinders)
@color = color
@owner = owner
@cylinders = cylinders
end
def color
@color
end
def owner
@owner
end
def cylinders
@cylinders
end
end
dans_car = Car.new('black', 'Dan', 4)
dans_car.color
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment