Skip to content

Instantly share code, notes, and snippets.

@harrisonmalone
Created September 24, 2018 06:17
Show Gist options
  • Save harrisonmalone/7c9d3b3eee8e4bc12bcd3f7dc7dfe646 to your computer and use it in GitHub Desktop.
Save harrisonmalone/7c9d3b3eee8e4bc12bcd3f7dc7dfe646 to your computer and use it in GitHub Desktop.
class Computer
def initialize(brand)
@brand = brand
@power = false
end
def power_on
@power = true
end
def power_off
@power = false
end
def power
@power
end
def brand=(computer_brand)
@brand = computer_brand
end
def brand
@brand
end
end
macbook_air = Computer.new
macbook_air.power_on
macbook_air.brand = "Apple"
p macbook_air
macbook_air.power_off
p macbook_air.power
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment