Class: Alchemy::ResourceFilter
- Inherits:
-
Object
- Object
- Alchemy::ResourceFilter
- Defined in:
- lib/alchemy/resource_filter.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(filter, resource_name) ⇒ ResourceFilter
constructor
A new instance of ResourceFilter.
- #options_for_select ⇒ Object
- #values ⇒ Object
Constructor Details
#initialize(filter, resource_name) ⇒ ResourceFilter
Returns a new instance of ResourceFilter.
7 8 9 10 11 12 |
# File 'lib/alchemy/resource_filter.rb', line 7 def initialize(filter, resource_name) @filter = filter @name = filter[:name] @resource_name = resource_name @values = filter[:values].presence || [] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/alchemy/resource_filter.rb', line 5 def name @name end |
Instance Method Details
#options_for_select ⇒ Object
14 15 16 |
# File 'lib/alchemy/resource_filter.rb', line 14 def translated_values.zip(values) end |
#values ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/alchemy/resource_filter.rb', line 18 def values if translated? @values.map { |v| v[1] } else @values end end |