Class: Refine::Filters::Builder

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
app/models/refine/filters/builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Builder

Returns a new instance of Builder.



18
19
20
21
22
23
# File 'app/models/refine/filters/builder.rb', line 18

def initialize(attrs = {})
  super
  @client_id ||= SecureRandom.uuid
  set_refine_filter_and_blueprint!
  set_query!
end

Instance Attribute Details

#blueprint ⇒ Object (readonly)

Returns the value of attribute blueprint.



16
17
18
# File 'app/models/refine/filters/builder.rb', line 16

def blueprint
  @blueprint
end

#blueprint_json ⇒ Object

Returns the value of attribute blueprint_json.



9
10
11
# File 'app/models/refine/filters/builder.rb', line 9

def blueprint_json
  @blueprint_json
end

#client_id ⇒ Object

Returns the value of attribute client_id.



9
10
11
# File 'app/models/refine/filters/builder.rb', line 9

def client_id
  @client_id
end

#filter_class ⇒ Object

Returns the value of attribute filter_class.



9
10
11
# File 'app/models/refine/filters/builder.rb', line 9

def filter_class
  @filter_class
end

#initial_query ⇒ Object

Returns the value of attribute initial_query.



9
10
11
# File 'app/models/refine/filters/builder.rb', line 9

def initial_query
  @initial_query
end

#query ⇒ Object (readonly)

Returns the value of attribute query.



16
17
18
# File 'app/models/refine/filters/builder.rb', line 16

def query
  @query
end

#refine_filter ⇒ Object (readonly)

Returns the value of attribute refine_filter.



16
17
18
# File 'app/models/refine/filters/builder.rb', line 16

def refine_filter
  @refine_filter
end

#stable_id ⇒ Object

Returns the value of attribute stable_id.



9
10
11
# File 'app/models/refine/filters/builder.rb', line 9

def stable_id
  @stable_id
end

#stored_filter_id ⇒ Object

Returns the value of attribute stored_filter_id.



9
10
11
# File 'app/models/refine/filters/builder.rb', line 9

def stored_filter_id
  @stored_filter_id
end

Instance Method Details

#to_key ⇒ Object

For use with the Rails dom_id helper



38
39
40
# File 'app/models/refine/filters/builder.rb', line 38

def to_key
  [client_id]
end

#to_params ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'app/models/refine/filters/builder.rb', line 25

def to_params
  {
    refine_filters_builder: {
      blueprint_json: blueprint.to_json,
      stable_id: stable_id,
      stored_filter_id: stored_filter_id,
      client_id: client_id,
      filter_class: filter_class
    }
  }
end