Class: Pello::Card
Constant Summary collapse
- NAME_REGEX =
/(\(([0-9.]*)\))*\s*([0-9.]*)\s*🍅*\s*(.*)/.freeze
Instance Attribute Summary collapse
-
#trello_card ⇒ Object
Returns the value of attribute trello_card.
Instance Method Summary collapse
- #extract_name ⇒ Object
- #extract_points ⇒ Object
- #extract_pomodori ⇒ Object
-
#initialize(trello_card) ⇒ Card
constructor
A new instance of Card.
Constructor Details
#initialize(trello_card) ⇒ Card
Returns a new instance of Card.
12 13 14 |
# File 'lib/pello/card.rb', line 12 def initialize(trello_card) @trello_card = trello_card end |
Instance Attribute Details
#trello_card ⇒ Object
Returns the value of attribute trello_card.
9 10 11 |
# File 'lib/pello/card.rb', line 9 def trello_card @trello_card end |
Instance Method Details
#extract_name ⇒ Object
22 23 24 |
# File 'lib/pello/card.rb', line 22 def extract_name name.match(NAME_REGEX)[-1] end |
#extract_points ⇒ Object
26 27 28 29 30 |
# File 'lib/pello/card.rb', line 26 def extract_points points = name.match(NAME_REGEX)[2] points ||= 0 points.to_f end |
#extract_pomodori ⇒ Object
16 17 18 19 20 |
# File 'lib/pello/card.rb', line 16 def extract_pomodori pomos = name.match(NAME_REGEX)[3] pomos ||= 0 pomos.to_i end |