Class: TheFox::Timr::Status
- Inherits:
-
Object
- Object
- TheFox::Timr::Status
- Includes:
- Term::ANSIColor
- Defined in:
- lib/timr/status.rb
Overview
Used as [Task](TheFox::Timr::Model::Task) and [Track](TheFox::Timr::Model::Track) Status.
-
‘R` running
-
‘S` stopped
-
‘P` paused. It’s actually stopped but with an additional flag.
-
‘-` (dash) not started
-
‘U` unknown
Instance Attribute Summary collapse
-
#long_status ⇒ Object
readonly
Resolved by ‘short_status`.
-
#short_status ⇒ Object
readonly
Source Data.
Instance Method Summary collapse
-
#colorized ⇒ Object
Use ‘term/ansicolor` to colorize the Long Status.
-
#initialize(short_status) ⇒ Status
constructor
A new instance of Status.
-
#to_s ⇒ Object
To String.
Constructor Details
#initialize(short_status) ⇒ Status
Returns a new instance of Status.
24 25 26 27 28 29 |
# File 'lib/timr/status.rb', line 24 def initialize(short_status) @short_status = short_status @long_status = nil set_long_status end |
Instance Attribute Details
#long_status ⇒ Object (readonly)
Resolved by ‘short_status`. See `set_long_status` method.
22 23 24 |
# File 'lib/timr/status.rb', line 22 def long_status @long_status end |
#short_status ⇒ Object (readonly)
Source Data
19 20 21 |
# File 'lib/timr/status.rb', line 19 def short_status @short_status end |
Instance Method Details
#colorized ⇒ Object
Use ‘term/ansicolor` to colorize the Long Status.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/timr/status.rb', line 32 def colorized case @short_status when ?R green(@long_status) when ?S red(@long_status) else @long_status end end |
#to_s ⇒ Object
To String
44 45 46 |
# File 'lib/timr/status.rb', line 44 def to_s long_status end |