module SardonyxRing::DSL::ClassMethods

Public Instance Methods

action(event_name, &block) click to toggle source
# File lib/sardonyx_ring/dsl.rb, line 59
def action(event_name, &block)
  action_handlers.push Handlers::ActionHandler.new(
    event_name,
    create_handler_method(&block)
  )
end
action_handlers() click to toggle source
# File lib/sardonyx_ring/dsl.rb, line 30
def action_handlers
  @action_handlers ||= []
end
cron_handlers() click to toggle source
# File lib/sardonyx_ring/dsl.rb, line 46
def cron_handlers
  @cron_handlers ||= []
end
event(event_name, &block) click to toggle source
# File lib/sardonyx_ring/dsl.rb, line 73
def event(event_name, &block)
  event_handlers.push Handlers::EventHandler.new(
    event_name,
    create_handler_method(&block)
  )
end
event_handlers() click to toggle source
# File lib/sardonyx_ring/dsl.rb, line 38
def event_handlers
  @event_handlers ||= []
end
every(cron_format, &block) click to toggle source
# File lib/sardonyx_ring/dsl.rb, line 80
def every(cron_format, &block)
  cron_handlers.push Handlers::CronHandler.new(
    cron_format,
    create_handler_method(&block)
  )
end
message(pattern, &block) click to toggle source
# File lib/sardonyx_ring/dsl.rb, line 50
def message(pattern, &block)
  message_handlers.push Handlers::MessageHandler.new(
    pattern,
    create_handler_method(&block)
  )
end
Also aliased as: on
message_handlers() click to toggle source
# File lib/sardonyx_ring/dsl.rb, line 34
def message_handlers
  @message_handlers ||= []
end
on(pattern, &block)
Alias for: message
view(callback_id, &block) click to toggle source
# File lib/sardonyx_ring/dsl.rb, line 66
def view(callback_id, &block)
  view_handlers.push Handlers::ViewHandler.new(
    callback_id,
    create_handler_method(&block)
  )
end
view_handlers() click to toggle source
# File lib/sardonyx_ring/dsl.rb, line 42
def view_handlers
  @view_handlers ||= []
end

Private Instance Methods

create_handler_method(&block) click to toggle source
# File lib/sardonyx_ring/dsl.rb, line 89
def create_handler_method(&block)
  tmp_name = :__tmp_handler_method
  define_method(tmp_name, &block)
  created_method = instance_method(tmp_name)
  remove_method(tmp_name)
  created_method
end