class AdditionBehavior
Public Class Methods
new(cache_behavior)
click to toggle source
defaultのbehavior以外はoriginに対してPATHが付加する
Calls superclass method
Behavior::new
# File lib/Behavior.rb, line 124 def initialize(cache_behavior) super(cache_behavior) @url = cache_behavior.path_pattern end
Public Instance Methods
store_code_for_backend_resp()
click to toggle source
Calls superclass method
Behavior#store_code_for_backend_resp
# File lib/Behavior.rb, line 141 def store_code_for_backend_resp # behaviorの条件 ## PATHの条件分岐を追加 ## origindomain/PATH もしくは origindomain/PATH?param=hoge であるurlの条件 @output_array_for_backend_resp << "if(bereq.url ~ \"^(#{@url.gsub(/\*/, ".*")}|#{@url.gsub(/\*/, ".*")}\\?.*)\"){" super @output_array_for_backend_resp << "}" @output_array_for_backend_resp.each_with_index do |code_line, index| code_line.insert(0, " ") end end
store_code_for_hash()
click to toggle source
Calls superclass method
Behavior#store_code_for_hash
# File lib/Behavior.rb, line 153 def store_code_for_hash # behaviorの条件 ## PATHの条件分岐を追加 ## origindomain/PATH もしくは origindomain/PATH?param=hoge であるurlの条件 if @forward_headers.items[0] != "*" @output_array_for_hash << "if(req.url ~ \"^(#{@url.gsub(/\*/, ".*")}|#{@url.gsub(/\*/, ".*")}\\?.*)\"){" super @output_array_for_hash << "}" @output_array_for_hash.each_with_index do |code_line, index| code_line.insert(0, " ") end end end
store_code_for_recv()
click to toggle source
Calls superclass method
Behavior#store_code_for_recv
# File lib/Behavior.rb, line 129 def store_code_for_recv # behaviorの条件 ## PATH PATTERN ## origindomain/PATH もしくは origindomain/PATH?param=hoge であるurlの条件 @output_array_for_recv << "if(req.url ~ \"^(#{@url.gsub(/\*/, ".*")}|#{@url.gsub(/\*/, ".*")}\\?.*)\"){" super @output_array_for_recv << "}" @output_array_for_recv.each_with_index do |code_line, index| code_line.insert(0, " ") end end