Class: FacetedSearch::Facets::Default
- Inherits:
-
Object
- Object
- FacetedSearch::Facets::Default
- Defined in:
- app/models/faceted_search/facets/default.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#facets ⇒ Object
readonly
Returns the value of attribute facets.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #add_scope(scope) ⇒ Object
-
#initialize(name, params, facets, options) ⇒ Default
constructor
A new instance of Default.
- #kind ⇒ Object
- #path(custom_params = @params) ⇒ Object
- #path_for(value) ⇒ Object
- #title ⇒ Object
- #to_s ⇒ Object
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, ) @name = name @params = params @facets = facets @options = end |
Instance Attribute Details
#facets ⇒ Object (readonly)
Returns the value of attribute facets.
3 4 5 |
# File 'app/models/faceted_search/facets/default.rb', line 3 def facets @facets end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'app/models/faceted_search/facets/default.rb', line 3 def name @name end |
#params ⇒ Object (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 |
#kind ⇒ Object
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 |
#title ⇒ Object
12 13 14 |
# File 'app/models/faceted_search/facets/default.rb', line 12 def title @options[:title] || name.to_s.humanize.titleize end |
#to_s ⇒ Object
34 35 36 |
# File 'app/models/faceted_search/facets/default.rb', line 34 def to_s "#{title}" end |