Class: Apill::Parameters
- Inherits:
-
Object
- Object
- Apill::Parameters
- Defined in:
- lib/apill/parameters.rb,
lib/apill/parameters/page.rb,
lib/apill/parameters/sort.rb,
lib/apill/parameters/index.rb,
lib/apill/parameters/filter.rb
Defined Under Namespace
Classes: Filter, Index, Page, Sort
Instance Attribute Summary collapse
-
#query_string ⇒ Object
Returns the value of attribute query_string.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(query_string) ⇒ Parameters
constructor
A new instance of Parameters.
- #process ⇒ Object
Constructor Details
#initialize(query_string) ⇒ Parameters
Returns a new instance of Parameters.
5 6 7 |
# File 'lib/apill/parameters.rb', line 5 def initialize(query_string) self.query_string = query_string end |
Instance Attribute Details
#query_string ⇒ Object
Returns the value of attribute query_string.
3 4 5 |
# File 'lib/apill/parameters.rb', line 3 def query_string @query_string end |
Class Method Details
.process(query_string) ⇒ Object
9 10 11 |
# File 'lib/apill/parameters.rb', line 9 def self.process(query_string) new(query_string).process end |
Instance Method Details
#process ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/apill/parameters.rb', line 13 def process return query_string unless query_string.respond_to? :gsub query_string.gsub(/(?<=\A|&|\?)[^=&]+/) do |match| match.tr('-', '_') end end |