Class: Ocular::Event::EventFactory
- Inherits:
-
Object
- Object
- Ocular::Event::EventFactory
- Defined in:
- lib/ocular/event/eventfactory.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
Returns the value of attribute files.
-
#handlers ⇒ Object
Returns the value of attribute handlers.
Instance Method Summary collapse
- #get(name) ⇒ Object
-
#initialize ⇒ EventFactory
constructor
A new instance of EventFactory.
- #load_from_block(name, &block) ⇒ Object
- #load_from_file(file, name = nil) ⇒ Object
- #start_input_handlers ⇒ Object
- #stop_input_handlers ⇒ Object
Constructor Details
#initialize ⇒ EventFactory
Returns a new instance of EventFactory.
47 48 49 50 |
# File 'lib/ocular/event/eventfactory.rb', line 47 def initialize @files = {} @handlers = ::Ocular::Inputs::Handlers.new end |
Instance Attribute Details
#files ⇒ Object
Returns the value of attribute files.
45 46 47 |
# File 'lib/ocular/event/eventfactory.rb', line 45 def files @files end |
#handlers ⇒ Object
Returns the value of attribute handlers.
44 45 46 |
# File 'lib/ocular/event/eventfactory.rb', line 44 def handlers @handlers end |
Instance Method Details
#get(name) ⇒ Object
70 71 72 |
# File 'lib/ocular/event/eventfactory.rb', line 70 def get(name) return @files[name] end |
#load_from_block(name, &block) ⇒ Object
63 64 65 66 67 68 |
# File 'lib/ocular/event/eventfactory.rb', line 63 def load_from_block(name, &block) proxy = DefinitionProxy.new(name, @handlers) proxy.instance_eval(&block) @files[name] = proxy return proxy end |
#load_from_file(file, name = nil) ⇒ Object
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/ocular/event/eventfactory.rb', line 52 def load_from_file(file, name = nil) if !name name = file end proxy = DefinitionProxy.new(name, @handlers) proxy.from_file(file) @files[name] = proxy return proxy end |
#start_input_handlers ⇒ Object
74 75 76 |
# File 'lib/ocular/event/eventfactory.rb', line 74 def start_input_handlers() @handlers.start() end |
#stop_input_handlers ⇒ Object
78 79 80 |
# File 'lib/ocular/event/eventfactory.rb', line 78 def stop_input_handlers() @handlers.stop() end |