Class: Light
Constant Summary
Constants included from CheekyDreams
Instance Attribute Summary collapse
-
#auditor ⇒ Object
Returns the value of attribute auditor.
-
#freq ⇒ Object
Returns the value of attribute freq.
Instance Method Summary collapse
- #go(effect) ⇒ Object
-
#initialize(driver) ⇒ Light
constructor
A new instance of Light.
- #off ⇒ Object
Methods included from CheekyDreams
#ansi_driver, #audit_to, #crazy, #cycle, #dev_null, #fade, #fade_to, #find_dream_cheeky_usb_device, #forward, #func, #light_show, #max, #position_between, #rgb, #rgb_between, #sleep_until, #solid, #stdio_audit, #stdout_driver, #suppress_duplicates, #throb, #throbbing
Constructor Details
#initialize(driver) ⇒ Light
Returns a new instance of Light.
381 382 383 384 385 |
# File 'lib/cheeky-dreams.rb', line 381 def initialize driver @driver, @auditor, @effect = driver, dev_null, solid(:off) @lock, @wake_up = Mutex.new, ConditionVariable.new @on = false end |
Instance Attribute Details
#auditor ⇒ Object
Returns the value of attribute auditor.
377 378 379 |
# File 'lib/cheeky-dreams.rb', line 377 def auditor @auditor end |
#freq ⇒ Object
Returns the value of attribute freq.
377 378 379 |
# File 'lib/cheeky-dreams.rb', line 377 def freq @freq end |
Instance Method Details
#go(effect) ⇒ Object
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/cheeky-dreams.rb', line 387 def go effect @lock.synchronize { case effect when Symbol @effect = solid(effect) when Array @effect = solid(effect) when CheekyDreams::Effects::Effect @effect = effect else raise "Im sorry dave, I'm afraid I can't do that. #{effect}" end } wakeup turn_on unless @on end |
#off ⇒ Object
404 405 406 |
# File 'lib/cheeky-dreams.rb', line 404 def off @on = false end |