Class: SearchScope::FilterScopeOption

Inherits:
Object
  • Object
show all
Defined in:
lib/search_scope.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, value, label, scope = nil) ⇒ FilterScopeOption

Returns a new instance of FilterScopeOption.

[View source]

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

#keyObject (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

#labelObject (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

#scopeObject (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

#valueObject (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