Class: Markdo::TaskAttribute

Inherits:
Object
  • Object
show all
Defined in:
lib/markdo/models/task_attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, value) ⇒ TaskAttribute

Returns a new instance of TaskAttribute.



7
8
9
10
# File 'lib/markdo/models/task_attribute.rb', line 7

def initialize(key, value)
  @key = key
  @value = value
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



5
6
7
# File 'lib/markdo/models/task_attribute.rb', line 5

def key
  @key
end

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/markdo/models/task_attribute.rb', line 5

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
# File 'lib/markdo/models/task_attribute.rb', line 18

def ==(other)
  other.key == key && other.value == value
end

#date_valueObject



12
13
14
15
16
# File 'lib/markdo/models/task_attribute.rb', line 12

def date_value
  Date.parse(value.to_s)
rescue ArgumentError
  nil
end