class Diesel::Middleware::SetPathParameter

Public Class Methods

new(app, options) click to toggle source
# File lib/diesel/middleware/set_path_parameter.rb, line 7
def initialize(app, options)
  super
  @regex = Regexp.new(Regexp.quote("{#{@name}}"))
end

Public Instance Methods

apply_parameter_value(env, value) click to toggle source
# File lib/diesel/middleware/set_path_parameter.rb, line 12
def apply_parameter_value(env, value)
  uri = env[:url]
  uri.resource_path = uri.resource_path.gsub(@regex, value.to_s)
end