Class: Barometer::Utils::Address
- Inherits:
-
Object
- Object
- Barometer::Utils::Address
- Defined in:
- lib/barometer/utils/address.rb
Instance Method Summary collapse
- #add(addition) ⇒ Object
-
#initialize(url, query = {}) ⇒ Address
constructor
A new instance of Address.
- #query ⇒ Object
- #to_s ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(url, query = {}) ⇒ Address
Returns a new instance of Address.
6 7 8 9 |
# File 'lib/barometer/utils/address.rb', line 6 def initialize(url, query={}) @address = Addressable::URI.parse(url) add(query) unless query.blank? end |
Instance Method Details
#add(addition) ⇒ Object
19 20 21 22 |
# File 'lib/barometer/utils/address.rb', line 19 def add(addition) current_values = address.query_values || {} address.query_values = current_values.merge(addition) end |
#query ⇒ Object
11 12 13 |
# File 'lib/barometer/utils/address.rb', line 11 def query address.query_values end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/barometer/utils/address.rb', line 24 def to_s address.to_s end |
#url ⇒ Object
15 16 17 |
# File 'lib/barometer/utils/address.rb', line 15 def url address.omit(:query).to_s end |