Class: RackReverseProxy::Rule::Candidate

Inherits:
Object
  • Object
show all
Defined in:
lib/rack_reverse_proxy/rule.rb

Overview

Candidate represents a request being matched

Instance Method Summary collapse

Constructor Details

#initialize(rule, has_custom_url, path, env, matches) ⇒ Candidate

Returns a new instance of Candidate.



66
67
68
69
70
71
72
73
74
# File 'lib/rack_reverse_proxy/rule.rb', line 66

def initialize(rule, has_custom_url, path, env, matches)
  @rule = rule
  @env = env
  @path = path
  @has_custom_url = has_custom_url
  @matches = matches

  @url = evaluate(matches.custom_url)
end

Instance Method Details

#build_uriObject



76
77
78
79
# File 'lib/rack_reverse_proxy/rule.rb', line 76

def build_uri
  return nil unless url
  raw_uri
end

#transform(response, request_uri) ⇒ Object



81
82
83
# File 'lib/rack_reverse_proxy/rule.rb', line 81

def transform(response, request_uri)
  matches.transform(response, request_uri)
end