Class: Carnival::QueryForm
- Inherits:
-
Object
- Object
- Carnival::QueryForm
- Defined in:
- app/models/carnival/query_form.rb
Instance Attribute Summary collapse
-
#date_period_from ⇒ Object
Returns the value of attribute date_period_from.
-
#date_period_label ⇒ Object
Returns the value of attribute date_period_label.
-
#date_period_to ⇒ Object
Returns the value of attribute date_period_to.
-
#scope ⇒ Object
Returns the value of attribute scope.
-
#search_term ⇒ Object
Returns the value of attribute search_term.
-
#sort_column ⇒ Object
Returns the value of attribute sort_column.
-
#sort_direction ⇒ Object
Returns the value of attribute sort_direction.
Instance Method Summary collapse
- #advanced_search ⇒ Object
-
#initialize(params) ⇒ QueryForm
constructor
A new instance of QueryForm.
- #page ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(params) ⇒ QueryForm
Returns a new instance of QueryForm.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/models/carnival/query_form.rb', line 5 def initialize(params) @scope = params[:scope] @search_term = params[:search_term] @advanced_search = params[:advanced_search] @date_period_label = params[:date_period_label] @date_period_from = params[:date_period_from] @date_period_to = params[:date_period_to] @sort_column = params[:sort_column] @sort_direction = params[:sort_direction] @page = params[:page] end |
Instance Attribute Details
#date_period_from ⇒ Object
Returns the value of attribute date_period_from.
3 4 5 |
# File 'app/models/carnival/query_form.rb', line 3 def date_period_from @date_period_from end |
#date_period_label ⇒ Object
Returns the value of attribute date_period_label.
3 4 5 |
# File 'app/models/carnival/query_form.rb', line 3 def date_period_label @date_period_label end |
#date_period_to ⇒ Object
Returns the value of attribute date_period_to.
3 4 5 |
# File 'app/models/carnival/query_form.rb', line 3 def date_period_to @date_period_to end |
#scope ⇒ Object
Returns the value of attribute scope.
3 4 5 |
# File 'app/models/carnival/query_form.rb', line 3 def scope @scope end |
#search_term ⇒ Object
Returns the value of attribute search_term.
3 4 5 |
# File 'app/models/carnival/query_form.rb', line 3 def search_term @search_term end |
#sort_column ⇒ Object
Returns the value of attribute sort_column.
3 4 5 |
# File 'app/models/carnival/query_form.rb', line 3 def sort_column @sort_column end |
#sort_direction ⇒ Object
Returns the value of attribute sort_direction.
3 4 5 |
# File 'app/models/carnival/query_form.rb', line 3 def sort_direction @sort_direction end |
Instance Method Details
#advanced_search ⇒ Object
17 18 19 20 |
# File 'app/models/carnival/query_form.rb', line 17 def advanced_search return {} if @advanced_search.nil? @advanced_search end |
#page ⇒ Object
31 32 33 34 |
# File 'app/models/carnival/query_form.rb', line 31 def page return 1 if @page.nil? @page.to_i end |
#to_hash ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'app/models/carnival/query_form.rb', line 22 def to_hash params = {} self.instance_variables.each do |var| var_name = var.to_s.gsub('@', '') params[var_name] = self.send(var_name) end params end |