class Ruboty::Router::Action
Attributes
options[R]
path[R]
Public Class Methods
new(path, options = {})
click to toggle source
# File lib/ruboty/router/action.rb, line 6 def initialize(path, options = {}) @path = path @options = options end
Public Instance Methods
call(router, _options = {})
click to toggle source
# File lib/ruboty/router/action.rb, line 11 def call(router, _options = {}) unless path.start_with? '/' puts I18n.t('warnings.invalid_route', path: path) return {} end proc = lambda do |env| req = Rack::Request.new(env) res = Rack::Response.new router.send(name, req, res) res.to_a end { path => proc } end
name()
click to toggle source
# File lib/ruboty/router/action.rb, line 25 def name options[:name] end