Class: Blinkman::Action
- Inherits:
-
Object
- Object
- Blinkman::Action
- Defined in:
- lib/blinkman/action.rb
Instance Attribute Summary collapse
-
#color_code ⇒ Object
readonly
Returns the value of attribute color_code.
-
#during ⇒ Object
readonly
Returns the value of attribute during.
-
#times ⇒ Object
readonly
Returns the value of attribute times.
Instance Method Summary collapse
-
#initialize(color_code, times, during = 1000) ⇒ Action
constructor
A new instance of Action.
- #invoke ⇒ Object
Constructor Details
#initialize(color_code, times, during = 1000) ⇒ Action
Returns a new instance of Action.
7 8 9 10 11 |
# File 'lib/blinkman/action.rb', line 7 def initialize(color_code, times, during = 1000) @color_code = color_code @times = times @during = during end |
Instance Attribute Details
#color_code ⇒ Object (readonly)
Returns the value of attribute color_code.
5 6 7 |
# File 'lib/blinkman/action.rb', line 5 def color_code @color_code end |
#during ⇒ Object (readonly)
Returns the value of attribute during.
5 6 7 |
# File 'lib/blinkman/action.rb', line 5 def during @during end |
#times ⇒ Object (readonly)
Returns the value of attribute times.
5 6 7 |
# File 'lib/blinkman/action.rb', line 5 def times @times end |
Instance Method Details
#invoke ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/blinkman/action.rb', line 13 def invoke color_code = @color_code times = @times.count.to_i during = @during Blink1.open do |blink1| blink1.delay_millis = blink1.millis = during / times blink1.blink(color_code[:r], color_code[:g], color_code[:b], times) end end |