Class: Shogun::Dispatch::Route

Inherits:
Object
  • Object
show all
Defined in:
lib/shogun/dispatch/route.rb,
lib/shogun/dispatch/route/null.rb

Defined Under Namespace

Classes: Null

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(namespace:, verb:, matcher:, control:) ⇒ Route

Returns a new instance of Route.



8
9
10
11
12
13
# File 'lib/shogun/dispatch/route.rb', line 8

def initialize(namespace:, verb:, matcher:, control:)
  @namespace = namespace
  @verb = verb
  @matcher = matcher
  @control = control
end

Instance Attribute Details

#controlObject (readonly)

Returns the value of attribute control.



6
7
8
# File 'lib/shogun/dispatch/route.rb', line 6

def control
  @control
end

Instance Method Details

#as_keyObject



15
16
17
# File 'lib/shogun/dispatch/route.rb', line 15

def as_key
  if expression? then Regexp.new("^#{verb} /#{path}$") else "#{verb} /#{path}" end
end