Class: Ocular::Inputs::Cron::Input::DSLProxy
- Inherits:
-
Object
- Object
- Ocular::Inputs::Cron::Input::DSLProxy
- Defined in:
- lib/ocular/inputs/cron_input.rb
Instance Method Summary collapse
- #at(rule, &block) ⇒ Object
- #cron(rule, &block) ⇒ Object
- #every(rule, &block) ⇒ Object
- #in(rule, &block) ⇒ Object
-
#initialize(proxy, handler, logger) ⇒ DSLProxy
constructor
A new instance of DSLProxy.
Constructor Details
#initialize(proxy, handler, logger) ⇒ DSLProxy
Returns a new instance of DSLProxy.
75 76 77 78 79 |
# File 'lib/ocular/inputs/cron_input.rb', line 75 def initialize(proxy, handler, logger) @proxy = proxy @handler = handler @logger = logger end |
Instance Method Details
#at(rule, &block) ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/ocular/inputs/cron_input.rb', line 98 def at(rule, &block) eventbase = Ocular::DSL::EventBase.new(@proxy, &block) ::Ocular.logger.debug "Scheduling cron.at(#{rule}) for block #{block}" id = @handler.scheduler.at(rule, :overlap => false) do if @handler.cron_enabled context = ::Ocular::DSL::RunContext.new(@logger) context.log_cause("cron.at", {:rule => rule}) eventbase.exec(context) end end @proxy.events[id] = eventbase return id end |
#cron(rule, &block) ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/ocular/inputs/cron_input.rb', line 132 def cron(rule, &block) eventbase = Ocular::DSL::EventBase.new(@proxy, &block) ::Ocular.logger.debug "Scheduling cron.cron(#{rule}) for block #{block}" id = @handler.scheduler.cron(rule, :overlap => false) do if @handler.cron_enabled context = ::Ocular::DSL::RunContext.new(@logger) context.log_cause("cron.cron", {:rule => rule}) eventbase.exec(context) end end @proxy.events[id] = eventbase return id end |
#every(rule, &block) ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/ocular/inputs/cron_input.rb', line 115 def every(rule, &block) eventbase = Ocular::DSL::EventBase.new(@proxy, &block) ::Ocular.logger.debug "Scheduling cron.every(#{rule}) for block #{block}" id = @handler.scheduler.every(rule, :overlap => false) do if @handler.cron_enabled context = ::Ocular::DSL::RunContext.new(@logger) context.log_cause("cron.every", {:rule => rule}) eventbase.exec(context) end end @proxy.events[id] = eventbase return id end |
#in(rule, &block) ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/ocular/inputs/cron_input.rb', line 81 def in(rule, &block) eventbase = Ocular::DSL::EventBase.new(@proxy, &block) ::Ocular.logger.debug "Scheduling cron.in(#{rule}) for block #{block}" id = @handler.scheduler.in(rule, :overlap => false) do if @handler.cron_enabled context = ::Ocular::DSL::RunContext.new(@logger) context.log_cause("cron.in", {:rule => rule}) eventbase.exec(context) end end @proxy.events[id] = eventbase return id end |