Class: Hacer::Todo

Inherits:
Object
  • Object
show all
Defined in:
lib/hacer.rb

Direct Known Subclasses

TodoInternal

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTodo

Do not create Todos this way, use the Todolist instead



107
108
109
# File 'lib/hacer.rb', line 107

def initialize
  raise "Use the Todolist to create todos"
end

Instance Attribute Details

#textObject (readonly)

Text of the todo



99
100
101
# File 'lib/hacer.rb', line 99

def text
  @text
end

#todo_idObject (readonly)

id of the todo



101
102
103
# File 'lib/hacer.rb', line 101

def todo_id
  @todo_id
end

Instance Method Details

#completed?Boolean

Returns true if this todo has been completed

Returns:

  • (Boolean)


104
# File 'lib/hacer.rb', line 104

def completed?; @completed; end

#to_sObject



111
112
113
114
115
# File 'lib/hacer.rb', line 111

def to_s
  s = "Todo(#{todo_id},#{text}"
  s += ",completed" if completed?
  s + ")"
end