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.
59 60 61 62 |
# File 'lib/ocular/event/eventfactory.rb', line 59 def initialize @files = {} @handlers = ::Ocular::Inputs::Handlers.new end |
Instance Attribute Details
#files ⇒ Object
Returns the value of attribute files.
57 58 59 |
# File 'lib/ocular/event/eventfactory.rb', line 57 def files @files end |
#handlers ⇒ Object
Returns the value of attribute handlers.
56 57 58 |
# File 'lib/ocular/event/eventfactory.rb', line 56 def handlers @handlers end |
Instance Method Details
#get(name) ⇒ Object
84 85 86 |
# File 'lib/ocular/event/eventfactory.rb', line 84 def get(name) return @files[name] end |
#load_from_block(name, &block) ⇒ Object
77 78 79 80 81 82 |
# File 'lib/ocular/event/eventfactory.rb', line 77 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
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/ocular/event/eventfactory.rb', line 64 def load_from_file(file, name = nil) if !name name = file end pn = Pathname.new(file) proxy = DefinitionProxy.new(name, pn.dirname, @handlers) proxy.from_file(file) @files[name] = proxy return proxy end |
#start_input_handlers ⇒ Object
88 89 90 |
# File 'lib/ocular/event/eventfactory.rb', line 88 def start_input_handlers() @handlers.start() end |
#stop_input_handlers ⇒ Object
92 93 94 |
# File 'lib/ocular/event/eventfactory.rb', line 92 def stop_input_handlers() @handlers.stop() end |