Class: Rack::ReverseProxyRule
- Inherits:
-
Object
- Object
- Rack::ReverseProxyRule
- Defined in:
- lib/rack/reverse_proxy_rule.rb
Instance Attribute Summary collapse
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #get_uri ⇒ Object
-
#initialize(rule) ⇒ ReverseProxyRule
constructor
A new instance of ReverseProxyRule.
- #match?(env) ⇒ Boolean
Constructor Details
#initialize(rule) ⇒ ReverseProxyRule
Returns a new instance of ReverseProxyRule.
4 5 6 7 8 9 10 |
# File 'lib/rack/reverse_proxy_rule.rb', line 4 def initialize rule if rule.kind_of?(Proc) || rule.respond_to?(:call) @rule = rule else raise "Invalid Rule for reverse_proxy" end end |
Instance Attribute Details
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
12 13 14 |
# File 'lib/rack/reverse_proxy_rule.rb', line 12 def rule @rule end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
12 13 14 |
# File 'lib/rack/reverse_proxy_rule.rb', line 12 def url @url end |
Instance Method Details
#get_uri ⇒ Object
18 19 20 21 |
# File 'lib/rack/reverse_proxy_rule.rb', line 18 def get_uri return nil if @url.nil? URI.parse(@url) end |
#match?(env) ⇒ Boolean
14 15 16 |
# File 'lib/rack/reverse_proxy_rule.rb', line 14 def match? env @url = @rule.call env end |