Class: RackReverseProxy::Rule
- Inherits:
-
Object
- Object
- RackReverseProxy::Rule
- Defined in:
- lib/rack_reverse_proxy/rule.rb
Overview
Rule understands which urls need to be proxied
Defined Under Namespace
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
FIXME: It needs to be hidden.
Instance Method Summary collapse
- #get_uri(path, env, *args) ⇒ Object
-
#initialize(spec, url = nil, options = {}) ⇒ Rule
constructor
A new instance of Rule.
- #proxy?(path, *args) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(spec, url = nil, options = {}) ⇒ Rule
Returns a new instance of Rule.
7 8 9 10 11 12 |
# File 'lib/rack_reverse_proxy/rule.rb', line 7 def initialize(spec, url = nil, = {}) @has_custom_url = url.nil? @url = url @options = @spec = build_matcher(spec) end |
Instance Attribute Details
#options ⇒ Object (readonly)
FIXME: It needs to be hidden
5 6 7 |
# File 'lib/rack_reverse_proxy/rule.rb', line 5 def @options end |
Instance Method Details
#get_uri(path, env, *args) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/rack_reverse_proxy/rule.rb', line 18 def get_uri(path, env, *args) Candidate.new( self, has_custom_url, path, env, matches(path, *args) ).build_uri end |
#proxy?(path, *args) ⇒ Boolean
14 15 16 |
# File 'lib/rack_reverse_proxy/rule.rb', line 14 def proxy?(path, *args) matches(path, *args).any? end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/rack_reverse_proxy/rule.rb', line 28 def to_s %("#{spec}" => "#{url}") end |