Created
September 24, 2018 06:17
-
-
Save harrisonmalone/7c9d3b3eee8e4bc12bcd3f7dc7dfe646 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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