Class: Dgrid::API::AugmentedURI
- Inherits:
-
Object
- Object
- Dgrid::API::AugmentedURI
- Defined in:
- lib/dgrid/api/connection.rb
Overview
Decorates URI::* with a params method that parses the query into a hash of parameters. Frankly this should be in URI::* and I am very tempted to monkey-patch it in there but Erik held me back. :)
Instance Method Summary collapse
-
#initialize(url_string) ⇒ AugmentedURI
constructor
A new instance of AugmentedURI.
- #method_missing(*args, &block) ⇒ Object
- #params ⇒ Object
Constructor Details
#initialize(url_string) ⇒ AugmentedURI
Returns a new instance of AugmentedURI.
28 29 30 |
# File 'lib/dgrid/api/connection.rb', line 28 def initialize(url_string) @delegate = URI.parse(url_string) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
32 33 34 |
# File 'lib/dgrid/api/connection.rb', line 32 def method_missing(*args, &block) @delegate.send(*args,&block) end |
Instance Method Details
#params ⇒ Object
36 37 38 |
# File 'lib/dgrid/api/connection.rb', line 36 def params Hash[ @delegate.query.split('&').map {|x| x.split('=')} ] end |