Class: Aikido::Zen::Rails::Route

Inherits:
Aikido::Zen::Route show all
Defined in:
lib/aikido/zen/request/rails_router.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Aikido::Zen::Route

#==, #as_json, #hash, #inspect

Constructor Details

#initialize(rails_route, verb: rails_route.verb, prefix: nil) ⇒ Route

Returns a new instance of Route.



69
70
71
72
73
# File 'lib/aikido/zen/request/rails_router.rb', line 69

def initialize(rails_route, verb: rails_route.verb, prefix: nil)
  @route = ActionDispatch::Routing::RouteWrapper.new(rails_route)
  @verb = verb
  @prefix = prefix
end

Instance Attribute Details

#verbObject (readonly)

Returns the value of attribute verb.



67
68
69
# File 'lib/aikido/zen/request/rails_router.rb', line 67

def verb
  @verb
end

Instance Method Details

#pathObject



75
76
77
78
79
80
81
# File 'lib/aikido/zen/request/rails_router.rb', line 75

def path
  if @prefix.present?
    File.join(@prefix.to_s, @route.path).chomp("/")
  else
    @route.path
  end
end