Skip to content

Instantly share code, notes, and snippets.

/ruby.rb Secret

Created February 7, 2016 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/49671bfbcab7b7be9fb4 to your computer and use it in GitHub Desktop.
Save anonymous/49671bfbcab7b7be9fb4 to your computer and use it in GitHub Desktop.
class TodoList
attr_reader :title, :items
def initialize(list_title)
@title = list_title
@items = Array.new
end
def add_item(new_item)
new_item = Item.new(new_item)
@items.push(new_item)
end
def delete_item(item) ######## Doesn't work. It just do nothing.
@items.delete(item)
end
end
class Item
attr_reader :description, :completed_status
def initialize(item_description)
@description = item_description
@completed_status = false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment