Class: Blinky::Light

Inherits:
Object
  • Object
show all
Defined in:
lib/blinky/light.rb

Instance Method Summary collapse

Constructor Details

#initialize(device_handle, recipe, plugins) ⇒ Light

Returns a new instance of Light.



4
5
6
7
8
9
10
11
# File 'lib/blinky/light.rb', line 4

def initialize device_handle, recipe, plugins
  @handle = device_handle
  self.extend(recipe)   
  plugins.each do |plugin|
    self.extend(plugin)
  end    
  self.init      
end

Instance Method Details

#where_are_you?Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
21
# File 'lib/blinky/light.rb', line 13

def where_are_you?
  5.times do
    failure!
    sleep(0.5)
    success!
    sleep(0.5)
  end
  off!      
end