Class: Ocular::Event::EventFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/ocular/event/eventfactory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEventFactory

Returns a new instance of EventFactory.



52
53
54
55
# File 'lib/ocular/event/eventfactory.rb', line 52

def initialize
    @files = {}
    @handlers = ::Ocular::Inputs::Handlers.new
end

Instance Attribute Details

#filesObject

Returns the value of attribute files.



50
51
52
# File 'lib/ocular/event/eventfactory.rb', line 50

def files
  @files
end

#handlersObject

Returns the value of attribute handlers.



49
50
51
# File 'lib/ocular/event/eventfactory.rb', line 49

def handlers
  @handlers
end

Instance Method Details

#get(name) ⇒ Object



75
76
77
# File 'lib/ocular/event/eventfactory.rb', line 75

def get(name)
    return @files[name]
end

#load_from_block(name, &block) ⇒ Object



68
69
70
71
72
73
# File 'lib/ocular/event/eventfactory.rb', line 68

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



57
58
59
60
61
62
63
64
65
66
# File 'lib/ocular/event/eventfactory.rb', line 57

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_handlersObject



79
80
81
# File 'lib/ocular/event/eventfactory.rb', line 79

def start_input_handlers()
    @handlers.start()
end

#stop_input_handlersObject



83
84
85
# File 'lib/ocular/event/eventfactory.rb', line 83

def stop_input_handlers()
    @handlers.stop()
end