Skip to content

Instantly share code, notes, and snippets.

@vanmichael
Last active December 29, 2015 10:59
Show Gist options
  • Save vanmichael/7660789 to your computer and use it in GitHub Desktop.
Save vanmichael/7660789 to your computer and use it in GitHub Desktop.
class Whiteboard
attr_accessor :contents
def initialize(contents = [])
@contents = contents
end
#instance method to erase whiteboard
def erase_whiteboard
@contents = []
end
end
class DryEraseMarker
attr_reader :color, :capacity
def initialize(color, capacity)
@color = color
@capacity = capacity
end
INK_USE_PER_CHARACTER = 0.01
def write(contents, whiteboard)
@capacity = @capacity - (INK_USE_PER_CHARACTER * contents.length)
whiteboard.contents << contents
end
#Check Ink Level
def check_ink?
@capacity > 0
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment