Class: RackCAS::URL

Inherits:
Addressable::URI
  • Object
show all
Defined in:
lib/rack-cas/url.rb

Instance Method Summary collapse

Instance Method Details

#add_params(params) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/rack-cas/url.rb', line 11

def add_params(params)
  self.tap do |u|
    u.query_values = (u.query_values || {}).tap do |qv|
      params.each do |key, value|
        qv[key] = value
      end
    end
  end
end

#append_path(path) ⇒ Object



5
6
7
8
9
# File 'lib/rack-cas/url.rb', line 5

def append_path(path)
  self.tap do |u|
    u.path = (u.path.split('/') + [path]).join('/')
  end
end

#dupObject



36
37
38
# File 'lib/rack-cas/url.rb', line 36

def dup
  RackCAS::URL.new(super.to_hash)
end

#remove_param(param) ⇒ Object



21
22
23
# File 'lib/rack-cas/url.rb', line 21

def remove_param(param)
  remove_params(Array(param))
end

#remove_params(params) ⇒ Object

params can be an array or a hash



26
27
28
29
30
31
32
33
34
# File 'lib/rack-cas/url.rb', line 26

def remove_params(params)
  self.tap do |u|
    u.query_values = (u.query_values || {}).tap do |qv|
      params.each do |key, value|
        qv.delete key
      end
    end
  end
end