Class: NormalizeUrl::Normalizer
- Inherits:
-
Object
- Object
- NormalizeUrl::Normalizer
- Defined in:
- lib/normalize_url/normalizer.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(original_uri, options = {}) ⇒ Normalizer
constructor
A new instance of Normalizer.
- #normalize ⇒ Object
Constructor Details
#initialize(original_uri, options = {}) ⇒ Normalizer
Returns a new instance of Normalizer.
7 8 9 10 |
# File 'lib/normalize_url/normalizer.rb', line 7 def initialize(original_uri, ={}) @uri = Addressable::URI.parse(original_uri).normalize @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/normalize_url/normalizer.rb', line 5 def @options end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
5 6 7 |
# File 'lib/normalize_url/normalizer.rb', line 5 def uri @uri end |
Instance Method Details
#normalize ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/normalize_url/normalizer.rb', line 12 def normalize process :remove_trailing_slash process :remove_repeating_slashes process :remove_hash process :sort_query uri.to_s end |