Class: Todo

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(description) ⇒ Todo

Returns a new instance of Todo.



7
8
9
10
11
# File 'lib/todo.rb', line 7

def initialize(description)
  @description = description
  @status = :pending
  @tags = []
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/todo.rb', line 4

def description
  @description
end

#finished_atObject

Returns the value of attribute finished_at.



5
6
7
# File 'lib/todo.rb', line 5

def finished_at
  @finished_at
end

#statusObject

Returns the value of attribute status.



5
6
7
# File 'lib/todo.rb', line 5

def status
  @status
end

#tagsObject

Returns the value of attribute tags.



5
6
7
# File 'lib/todo.rb', line 5

def tags
  @tags
end

Instance Method Details

#idObject



13
14
15
16
17
# File 'lib/todo.rb', line 13

def id
  description_hash = OpenSSL::Digest::SHA1.new(@description)
  description_hash = description_hash.hexdigest
  description_hash.slice(0..5)
end