Class: Kaya::Support::QueryString
- Inherits:
-
Object
- Object
- Kaya::Support::QueryString
- Defined in:
- lib/kaya/support/query_string.rb
Instance Attribute Summary collapse
-
#req ⇒ Object
readonly
Returns the value of attribute req.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(req) ⇒ QueryString
constructor
req = Request.
- #method_missing(key, *args, &block) ⇒ Object
- #value_for(key) ⇒ Object
Constructor Details
#initialize(req) ⇒ QueryString
req = Request
8 9 10 11 |
# File 'lib/kaya/support/query_string.rb', line 8 def initialize req @req = req @values = Rack::Utils.parse_nested_query(req.query_string.split("/").last) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(key, *args, &block) ⇒ Object
17 18 19 |
# File 'lib/kaya/support/query_string.rb', line 17 def method_missing(key, *args, &block) @values[key.to_s] end |
Instance Attribute Details
#req ⇒ Object (readonly)
Returns the value of attribute req.
5 6 7 |
# File 'lib/kaya/support/query_string.rb', line 5 def req @req end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
5 6 7 |
# File 'lib/kaya/support/query_string.rb', line 5 def values @values end |
Instance Method Details
#value_for(key) ⇒ Object
13 14 15 |
# File 'lib/kaya/support/query_string.rb', line 13 def value_for key @values[key] end |