Class: SearchScope::FilterScopeOption
- Inherits:
-
Object
- Object
- SearchScope::FilterScopeOption
- Defined in:
- lib/search_scope.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
options can supply a value to fill in for their filter_scope, or a separate scope (symbol for a named_scope) or conditions/include to use instead.
-
#label ⇒ Object
readonly
options can supply a value to fill in for their filter_scope, or a separate scope (symbol for a named_scope) or conditions/include to use instead.
-
#scope ⇒ Object
readonly
options can supply a value to fill in for their filter_scope, or a separate scope (symbol for a named_scope) or conditions/include to use instead.
-
#value ⇒ Object
readonly
options can supply a value to fill in for their filter_scope, or a separate scope (symbol for a named_scope) or conditions/include to use instead.
Instance Method Summary collapse
-
#initialize(key, value, label, scope = nil) ⇒ FilterScopeOption
constructor
A new instance of FilterScopeOption.
Constructor Details
permalink #initialize(key, value, label, scope = nil) ⇒ FilterScopeOption
Returns a new instance of FilterScopeOption.
21 22 23 24 25 26 |
# File 'lib/search_scope.rb', line 21 def initialize(key, value, label, scope=nil) label ||= key.to_s.titleize value ||= key value = value.to_s if value.is_a? Symbol @key, @value, @label, @scope = key, value, label, scope end |
Instance Attribute Details
permalink #key ⇒ Object (readonly)
options can supply a value to fill in for their filter_scope, or a separate scope (symbol for a named_scope) or conditions/include to use instead.
20 21 22 |
# File 'lib/search_scope.rb', line 20 def key @key end |
permalink #label ⇒ Object (readonly)
options can supply a value to fill in for their filter_scope, or a separate scope (symbol for a named_scope) or conditions/include to use instead.
20 21 22 |
# File 'lib/search_scope.rb', line 20 def label @label end |
permalink #scope ⇒ Object (readonly)
options can supply a value to fill in for their filter_scope, or a separate scope (symbol for a named_scope) or conditions/include to use instead.
20 21 22 |
# File 'lib/search_scope.rb', line 20 def scope @scope end |
permalink #value ⇒ Object (readonly)
options can supply a value to fill in for their filter_scope, or a separate scope (symbol for a named_scope) or conditions/include to use instead.
20 21 22 |
# File 'lib/search_scope.rb', line 20 def value @value end |