Class: Blinky::Blinky
- Inherits:
-
Object
- Object
- Blinky::Blinky
- Defined in:
- lib/blinky.rb
Instance Method Summary collapse
-
#initialize(path = File.dirname(__FILE__)) ⇒ Blinky
constructor
A new instance of Blinky.
- #light ⇒ Object
- #lights ⇒ Object
- #plugin(plugin_module) ⇒ Object
- #recipe(recipe_module, details) ⇒ Object
Constructor Details
#initialize(path = File.dirname(__FILE__)) ⇒ Blinky
Returns a new instance of Blinky.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/blinky.rb', line 16 def initialize(path = File.dirname(__FILE__)) Dir["#{path}/device_recipes/**/*.rb"].each { |f| require(f) } @recipes = Hash.new({}) instance_eval(File.read("#{path}/recipes.rb")) Dir["#{path}/ci_server_plugins/**/*.rb"].each { |f| require(f) } @plugins = [] instance_eval(File.read("#{path}/plugins.rb")) @lights = LightFactory.detect_lights(@plugins, @recipes) end |
Instance Method Details
#light ⇒ Object
33 34 35 |
# File 'lib/blinky.rb', line 33 def light @lights.first end |
#lights ⇒ Object
29 30 31 |
# File 'lib/blinky.rb', line 29 def lights @lights end |
#plugin(plugin_module) ⇒ Object
45 46 47 |
# File 'lib/blinky.rb', line 45 def plugin plugin_module @plugins << plugin_module end |
#recipe(recipe_module, details) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/blinky.rb', line 37 def recipe recipe_module, details if @recipes[details[:usb_vendor_id]].empty? @recipes[details[:usb_vendor_id]] = {details[:usb_product_id] => recipe_module} else @recipes[details[:usb_vendor_id]][details[:usb_product_id]] = recipe_module end end |