Class: Ocular::Event::DefinitionProxy

Inherits:
Object
  • Object
show all
Includes:
DSL::Cache, DSL::Etcd, DSL::Fog, DSL::Graphite, DSL::Logging, DSL::MySQL, DSL::RabbitMQ, DSL::SSH, Inputs::Cron::DSL, Inputs::HTTP::DSL, Inputs::HTTP::ErrorDSL, Inputs::RabbitMQ::DSL, Inputs::Trigger::DSL, Mixin::FromFile
Defined in:
lib/ocular/event/eventfactory.rb

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::Cache

#cache_get, #cache_set

Methods included from DSL::Graphite

#graphite, #graphite_get_latests

Methods included from DSL::RabbitMQ

#amqp

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

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, handlers) ⇒ DefinitionProxy

Returns a new instance of DefinitionProxy.



15
16
17
18
19
20
21
# File 'lib/ocular/event/eventfactory.rb', line 15

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

Instance Attribute Details

#do_forkObject (readonly)

Returns the value of attribute do_fork.



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

def do_fork
  @do_fork
end

#eventsObject

Returns the value of attribute events.



11
12
13
# File 'lib/ocular/event/eventfactory.rb', line 11

def events
  @events
end

#handlersObject

Returns the value of attribute handlers.



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

def handlers
  @handlers
end

#loggerObject (readonly)

Returns the value of attribute logger.



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

def logger
  @logger
end

#script_nameObject (readonly)

Returns the value of attribute script_name.



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

def script_name
  @script_name
end

Instance Method Details

#fork(value) ⇒ Object



39
40
41
# File 'lib/ocular/event/eventfactory.rb', line 39

def fork(value)
    @do_fork = value
end

#onEvent(type, &block) ⇒ Object



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

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