Class: Cue::Indicator
- Inherits:
-
Object
- Object
- Cue::Indicator
- Includes:
- ColorFool
- Defined in:
- lib/cue/indicator.rb
Constant Summary
Constants included from ColorFool
ColorFool::CODES, ColorFool::COLORS
Instance Attribute Summary collapse
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #color ⇒ Object
-
#initialize(state) ⇒ Indicator
constructor
A new instance of Indicator.
- #symbol ⇒ Object
- #to_s ⇒ Object
Methods included from ColorFool
Constructor Details
#initialize(state) ⇒ Indicator
Returns a new instance of Indicator.
9 10 11 |
# File 'lib/cue/indicator.rb', line 9 def initialize(state) @state = state end |
Instance Attribute Details
#state ⇒ Object (readonly)
Returns the value of attribute state.
7 8 9 |
# File 'lib/cue/indicator.rb', line 7 def state @state end |
Instance Method Details
#color ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/cue/indicator.rb', line 13 def color case state when :complete :green when :incomplete :red else :none end end |
#symbol ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/cue/indicator.rb', line 24 def symbol case state when :complete '✓' when :incomplete '✗' else '?' end end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/cue/indicator.rb', line 35 def to_s colorize(color) { symbol } end |