class Ruboty::Routers::Base

Attributes

robot[R]

Public Class Methods

actions() click to toggle source
# File lib/ruboty/routers/base.rb, line 15
def actions
  []
end
inherited(child) click to toggle source
# File lib/ruboty/routers/base.rb, line 7
def inherited(child)
  Ruboty::Router.routers << child
end
new(robot) click to toggle source
# File lib/ruboty/routers/base.rb, line 25
def initialize(robot)
  @robot = robot
  validate!
end
route(path, options = {}) click to toggle source
# File lib/ruboty/routers/base.rb, line 11
def route(path, options = {})
  actions << Router::Action.new(path, options)
end

Public Instance Methods

call(options = {}) click to toggle source
# File lib/ruboty/routers/base.rb, line 30
def call(options = {})
  self.class.actions.inject({}) do |routes, action|
    routes.merge!(action.call(self, options))
  end
end