Class: Shrinker::EasyUrl
- Inherits:
-
Struct
- Object
- Struct
- Shrinker::EasyUrl
- Defined in:
- lib/shrinker/easy_url.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes
2 3 4 |
# File 'lib/shrinker/easy_url.rb', line 2 def attributes @attributes end |
#url ⇒ Object
Returns the value of attribute url
2 3 4 |
# File 'lib/shrinker/easy_url.rb', line 2 def url @url end |
Instance Method Details
#=~(regexp) ⇒ Object
5 6 7 |
# File 'lib/shrinker/easy_url.rb', line 5 def =~(regexp) to_s =~ regexp end |
#params ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/shrinker/easy_url.rb', line 15 def params @params ||= begin hash = {} CGI.parse(parsed_uri.query).each_pair do |key, value| hash[key.to_sym] = value.length == 1 ? value.first : value end if parsed_uri.query hash end end |
#to_s ⇒ Object
9 10 11 12 13 |
# File 'lib/shrinker/easy_url.rb', line 9 def to_s parsed_uri.query = to_param parsed_uri.query = nil if parsed_uri.query == '' parsed_uri.to_s end |