Class: Ocular::Inputs::Handlers
- Inherits:
-
Object
- Object
- Ocular::Inputs::Handlers
- Defined in:
- lib/ocular/inputs/handlers.rb
Instance Method Summary collapse
- #get(klass) ⇒ Object
-
#initialize ⇒ Handlers
constructor
A new instance of Handlers.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize ⇒ Handlers
Returns a new instance of Handlers.
7 8 9 |
# File 'lib/ocular/inputs/handlers.rb', line 7 def initialize @handlers = Hash.new end |
Instance Method Details
#get(klass) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/ocular/inputs/handlers.rb', line 11 def get(klass) if @handlers[klass] return @handlers[klass] end @handlers[klass] = klass.new(::Ocular::Settings) return @handlers[klass] end |
#start ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/ocular/inputs/handlers.rb', line 20 def start() puts "Starting handlers..." @handlers.each do |name, handler| puts "Staring handler #{name} with #{handler}" handler.start() end end |
#stop ⇒ Object
28 29 30 31 32 |
# File 'lib/ocular/inputs/handlers.rb', line 28 def stop() @handlers.each do |name, handler| handler.stop() end end |