Class: Cas::Client::URL
- Inherits:
-
Object
- Object
- Cas::Client::URL
- Defined in:
- lib/cas/client/url.rb
Instance Method Summary collapse
- #add_query(query_string) ⇒ Object
- #append_path(path_string) ⇒ Object
-
#initialize(url) ⇒ URL
constructor
A new instance of URL.
- #to_s ⇒ Object
- #to_uri ⇒ Object
Constructor Details
#initialize(url) ⇒ URL
Returns a new instance of URL.
4 5 6 7 8 9 10 |
# File 'lib/cas/client/url.rb', line 4 def initialize(url) begin @url = URI(url) rescue URI::Error => e raise e end end |
Instance Method Details
#add_query(query_string) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/cas/client/url.rb', line 16 def add_query(query_string) if @url.query.nil? @url.query = query_string else @url.query += "&#{query_string}" end @url end |
#append_path(path_string) ⇒ Object
12 13 14 |
# File 'lib/cas/client/url.rb', line 12 def append_path(path_string) Cas::Client::URL.new("#{@url}#{path_string}") end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/cas/client/url.rb', line 29 def to_s @url.to_s end |
#to_uri ⇒ Object
25 26 27 |
# File 'lib/cas/client/url.rb', line 25 def to_uri URI(@url.to_s) end |