Class: FacetedSearch::Facets::Default

Inherits:
Object
  • Object
show all
Defined in:
app/models/faceted_search/facets/default.rb

Direct Known Subclasses

DefaultList, Text

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, params, facets, options) ⇒ Default

Returns a new instance of Default.



5
6
7
8
9
10
# File 'app/models/faceted_search/facets/default.rb', line 5

def initialize(name, params, facets, options)
  @name = name
  @params = params
  @facets = facets
  @options = options
end

Instance Attribute Details

#facetsObject (readonly)

Returns the value of attribute facets.



3
4
5
# File 'app/models/faceted_search/facets/default.rb', line 3

def facets
  @facets
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'app/models/faceted_search/facets/default.rb', line 3

def name
  @name
end

#paramsObject (readonly)

Returns the value of attribute params.



3
4
5
# File 'app/models/faceted_search/facets/default.rb', line 3

def params
  @params
end

Instance Method Details

#add_scope(scope) ⇒ Object



24
25
26
27
# File 'app/models/faceted_search/facets/default.rb', line 24

def add_scope(scope)
  # Override
  scope
end

#kindObject



16
17
18
# File 'app/models/faceted_search/facets/default.rb', line 16

def kind
  self.class.to_s
end

#path(custom_params = @params) ⇒ Object



29
30
31
32
# File 'app/models/faceted_search/facets/default.rb', line 29

def path(custom_params = @params)
  return '' if custom_params.blank?
  "&facets[#{name}]=#{custom_params}"
end

#path_for(value) ⇒ Object



20
21
22
# File 'app/models/faceted_search/facets/default.rb', line 20

def path_for(value)
  "&facets[#{name}]=#{value}"
end

#titleObject



12
13
14
# File 'app/models/faceted_search/facets/default.rb', line 12

def title
  @options[:title] || name.to_s.humanize.titleize
end

#to_sObject



34
35
36
# File 'app/models/faceted_search/facets/default.rb', line 34

def to_s
  "#{title}"
end