class AmpelExtase::LightSwitcher
Attributes
port[R]
Public Class Methods
for(serial:)
click to toggle source
# File lib/ampel_extase/light_switcher.rb, line 5 def self.for(serial:) if serial new SocketSwitcher::Port.new(serial) else Tins::NULL end end
new(port)
click to toggle source
# File lib/ampel_extase/light_switcher.rb, line 13 def initialize(port) @port = port end
Public Instance Methods
aux()
click to toggle source
# File lib/ampel_extase/light_switcher.rb, line 27 def aux @port.device(2) end
each(&block)
click to toggle source
# File lib/ampel_extase/light_switcher.rb, line 31 def each(&block) [ :green, :red, :aux, ].map { |color| __send__(color) }.each(&block) end
green()
click to toggle source
# File lib/ampel_extase/light_switcher.rb, line 19 def green @port.device(0) end
red()
click to toggle source
# File lib/ampel_extase/light_switcher.rb, line 23 def red @port.device(1) end