Class: Carnival::QueryForm

Inherits:
Object
  • Object
show all
Defined in:
app/models/carnival/query_form.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ QueryForm

Returns a new instance of QueryForm.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/models/carnival/query_form.rb', line 7

def initialize(params)
  @scope = params[:scope]
  @search_term = params[:search_term]
  @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]

  @advanced_search = params[:advanced_search] || {}
  @page = (params[:page] || 1).to_i
end

Instance Attribute Details

#advanced_searchObject

Returns the value of attribute advanced_search.



3
4
5
# File 'app/models/carnival/query_form.rb', line 3

def advanced_search
  @advanced_search
end

#date_period_fromObject

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_labelObject

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_toObject

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

#pageObject

Returns the value of attribute page.



3
4
5
# File 'app/models/carnival/query_form.rb', line 3

def page
  @page
end

#scopeObject

Returns the value of attribute scope.



3
4
5
# File 'app/models/carnival/query_form.rb', line 3

def scope
  @scope
end

#search_termObject

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_columnObject

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_directionObject

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

#to_hashObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/models/carnival/query_form.rb', line 20

def to_hash
  {
    'scope' => scope,
    'search_term' => search_term,
    'date_period_label' => date_period_label,
    'date_period_from' => date_period_from,
    'date_period_to' => date_period_to,
    'sort_column' => sort_column,
    'sort_direction' => sort_direction,
    'advanced_search' => advanced_search,
    'page' => page
  }
end