class Shogun::Dispatch::Route
Attributes
control[R]
Public Class Methods
new(namespace:, verb:, matcher:, control:)
click to toggle source
# File lib/shogun/dispatch/route.rb, line 8 def initialize(namespace:, verb:, matcher:, control:) @namespace = namespace @verb = verb @matcher = matcher @control = control end
Public Instance Methods
as_key()
click to toggle source
# File lib/shogun/dispatch/route.rb, line 15 def as_key if expression? then Regexp.new("^#{verb} /#{path}$") else "#{verb} /#{path}" end end
Private Instance Methods
expression?()
click to toggle source
# File lib/shogun/dispatch/route.rb, line 27 def expression? [@namespace, @matcher].any? do |item| item.is_a?(Regexp) end end
path()
click to toggle source
# File lib/shogun/dispatch/route.rb, line 19 def path @path ||= [@namespace, @matcher].compact.join("/") end
verb()
click to toggle source
# File lib/shogun/dispatch/route.rb, line 23 def verb @verb.to_s.upcase end