Class: URI::Generic

Inherits:
Object show all
Defined in:
lib/cnc/core_ext/uri.rb

Instance Method Summary collapse

Instance Method Details

#<(oth) ⇒ Object



22
# File 'lib/cnc/core_ext/uri.rb', line 22

def <(oth) = URI(oth) >= self

#<=(oth) ⇒ Object

Returns true if this URI is the same or less specific than oth URI.



10
11
12
13
# File 'lib/cnc/core_ext/uri.rb', line 10

def <=(oth)
  oth = URI(oth)
  oth.path.start_with?(path) && params <= oth.params
end

#>(oth) ⇒ Object



21
# File 'lib/cnc/core_ext/uri.rb', line 21

def >(oth) = URI(oth) <= self

#>=(oth) ⇒ Object

Returns true if oth URI is the same or less specific than itself.



16
17
18
19
# File 'lib/cnc/core_ext/uri.rb', line 16

def >=(oth)
  oth = URI(oth)
  path.start_with?(oth.path) && params >= oth.params
end

#paramsObject



5
6
7
# File 'lib/cnc/core_ext/uri.rb', line 5

def params
  Rack::Utils.parse_query(query)
end