class RouteNGNClient::URIMatcher
Constants
- HEADER_ORDER
Public Instance Methods
<=>(other)
click to toggle source
# File lib/routengn_client/models/uri_matcher.rb, line 9 def <=>(other) if @attributes.header == other.attributes.header case (@attributes.weight <=> other.attributes.weight) when 0 @attributes.id.to_s <=> other.attributes.id.to_s when 1 #self.weight is higher -1 when -1 #self.weight is lower 1 else 0 end else return 0 if !HEADER_ORDER.include?(@attributes.header) && !HEADER_ORDER.include?(other.attributes.header) return -1 if !HEADER_ORDER.include?(@attributes.header) return 1 if !HEADER_ORDER.include?(other.attributes.header) return (HEADER_ORDER.index(@attributes.header) <=> HEADER_ORDER.index(other.attributes.header)) end end
matches?(args = {})
click to toggle source
# File lib/routengn_client/models/uri_matcher.rb, line 33 def matches?(args = {}) return false if !self.matches_header?(args[:header]) return false if !@attributes.prefix.blank? && !self.matches_prefix?(args[:prefix]) return false if !@attributes.user_params.blank? && !self.matches_user_params?(args[:user_params]) return false if !@attributes.uri_params.blank? && !self.matches_uri_params?(args[:uri_params]) return true end
matches_header?(arg)
click to toggle source
# File lib/routengn_client/models/uri_matcher.rb, line 41 def matches_header?(arg) !@attributes.header.blank? && !arg.blank? && @attributes.header == arg end
matches_prefix?(arg)
click to toggle source
# File lib/routengn_client/models/uri_matcher.rb, line 45 def matches_prefix?(arg) @attributes.prefix == arg end
matches_uri_params?(arg)
click to toggle source
# File lib/routengn_client/models/uri_matcher.rb, line 59 def matches_uri_params?(arg) if arg.is_a?(String) @attributes.uri_params == arg elsif arg.is_a?(Array) arg.include?(@attributes.uri_params) else false end end
matches_user_params?(arg)
click to toggle source
# File lib/routengn_client/models/uri_matcher.rb, line 49 def matches_user_params?(arg) if arg.is_a?(String) @attributes.user_params == arg elsif arg.is_a?(Array) arg.include?(@attributes.user_params) else false end end
weight()
click to toggle source
# File lib/routengn_client/models/uri_matcher.rb, line 29 def weight @weight ||= [@attributes.prefix, @attributes.user_params, @attributes.uri_params].select { |x| !x.blank? }.length end