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.
46 47 48 49 50 |
# File 'lib/ocular/inputs/cron_input.rb', line 46 def initialize(proxy, handler, logger) @proxy = proxy @handler = handler @logger = logger end |
Instance Method Details
#at(rule, &block) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/ocular/inputs/cron_input.rb', line 66 def at(rule, &block) eventbase = Ocular::DSL::EventBase.new(@proxy, &block) id = @handler.scheduler.at(rule) do context = ::Ocular::DSL::RunContext.new(@logger) context.log_cause("cron.at", {:rule => rule}) eventbase.exec(context) end @proxy.events[id] = eventbase return id end |
#cron(rule, &block) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/ocular/inputs/cron_input.rb', line 94 def cron(rule, &block) eventbase = Ocular::DSL::EventBase.new(@proxy, &block) id = @handler.scheduler.cron(rule) do context = ::Ocular::DSL::RunContext.new(@logger) context.log_cause("cron.cron", {:rule => rule}) eventbase.exec(context) end @proxy.events[id] = eventbase return id end |
#every(rule, &block) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/ocular/inputs/cron_input.rb', line 80 def every(rule, &block) eventbase = Ocular::DSL::EventBase.new(@proxy, &block) id = @handler.scheduler.every(rule) do context = ::Ocular::DSL::RunContext.new(@logger) context.log_cause("cron.every", {:rule => rule}) eventbase.exec(context) end @proxy.events[id] = eventbase return id end |
#in(rule, &block) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/ocular/inputs/cron_input.rb', line 52 def in(rule, &block) eventbase = Ocular::DSL::EventBase.new(@proxy, &block) id = @handler.scheduler.in(rule) do context = ::Ocular::DSL::RunContext.new(@logger) context.log_cause("cron.in", {:rule => rule}) eventbase.exec(context) end @proxy.events[id] = eventbase return id end |