Class: Ocular::Event::DefinitionProxy

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Inputs::RabbitMQ::DSL

#rabbitmq

Methods included from Inputs::Trigger::DSL

#onTrigger

Methods included from Inputs::Cron::DSL

#cron

Methods included from Inputs::HTTP::DSL

#onDELETE, #onGET, #onOPTIONS, #onPOST

Methods included from DSL::File

#getfullpath

Methods included from DSL::Cache

#cache_get, #cache_set

Methods included from DSL::Graphite

#graphite, #graphite_get_latests

Methods included from DSL::RabbitMQ

#amqp

Methods included from DSL::Mongo

#mongo

Methods included from DSL::Psql

#psql

Methods included from DSL::MySQL

#mysql

Methods included from DSL::Etcd

#etcd, #locked?, #ttl_lock, #unlock

Methods included from DSL::Fog

#autoscaling, #aws, #find_server_by_id, #find_server_by_ip, #find_servers_in_autoscaling_groups, #get_servers_in_autoscaling_group

Methods included from DSL::SSH

#ssh_to

Methods included from DSL::Logging

#debug, #error, #fatal, #info, #log_cause, #log_event, #log_timing, #warn

Methods included from Mixin::FromFile

#class_from_file, #from_file

Constructor Details

#initialize(script_name, dirname, handlers) ⇒ DefinitionProxy

Returns a new instance of DefinitionProxy.



17
18
19
20
21
22
23
24
# File 'lib/ocular/event/eventfactory.rb', line 17

def initialize(script_name, dirname, handlers)
    @script_name = script_name
    @dirname = dirname
    @events = {}
    @logger = ::Ocular.logger
    @handlers = handlers
    @do_fork = true
end

Instance Attribute Details

#dirnameObject (readonly)

Returns the value of attribute dirname.



14
15
16
# File 'lib/ocular/event/eventfactory.rb', line 14

def dirname
  @dirname
end

#do_forkObject (readonly)

Returns the value of attribute do_fork.



14
15
16
# File 'lib/ocular/event/eventfactory.rb', line 14

def do_fork
  @do_fork
end

#eventsObject

Returns the value of attribute events.



13
14
15
# File 'lib/ocular/event/eventfactory.rb', line 13

def events
  @events
end

#handlersObject

Returns the value of attribute handlers.



15
16
17
# File 'lib/ocular/event/eventfactory.rb', line 15

def handlers
  @handlers
end

#loggerObject (readonly)

Returns the value of attribute logger.



14
15
16
# File 'lib/ocular/event/eventfactory.rb', line 14

def logger
  @logger
end

#script_nameObject (readonly)

Returns the value of attribute script_name.



14
15
16
# File 'lib/ocular/event/eventfactory.rb', line 14

def script_name
  @script_name
end

Instance Method Details

#fork(value) ⇒ Object



45
46
47
# File 'lib/ocular/event/eventfactory.rb', line 45

def fork(value)
    @do_fork = value
end

#onEvent(type, &block) ⇒ Object



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

def onEvent(type, &block)
    eventbase = Ocular::DSL::EventBase.new(self, &block)
    (@events["onEvent"] ||= {})[type] = eventbase
end