Class: MPS::Elements::Log
- Inherits:
-
Object
- Object
- MPS::Elements::Log
- Includes:
- MPS::Element
- Defined in:
- lib/mps/elements/log.rb
Constant Summary collapse
- SIGNATURE_STAMP =
"log"- SIGNATURE_REGEX =
/\Alog\z/
Instance Attribute Summary
Attributes included from MPS::Element
#body_str, #parsed_args, #raw_args
Instance Method Summary collapse
Methods included from MPS::Element
included, #initialize, split_args, #tags
Instance Method Details
#duration_minutes ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/mps/elements/log.rb', line 13 def duration_minutes s = parsed_args[:start] e = parsed_args[:end] return nil unless s && e sh, sm = s.split(":").map(&:to_i) eh, em = e.split(":").map(&:to_i) (eh * 60 + em) - (sh * 60 + sm) end |
#duration_str ⇒ Object
22 23 24 25 26 27 |
# File 'lib/mps/elements/log.rb', line 22 def duration_str mins = duration_minutes return nil unless mins && mins > 0 h, m = mins.divmod(60) m > 0 ? "#{h}h#{m}m" : "#{h}h" end |