Class: Spree::Filters::PropertyPresenter
- Inherits:
-
Object
- Object
- Spree::Filters::PropertyPresenter
- Defined in:
- app/presenters/spree/filters/property_presenter.rb
Instance Attribute Summary collapse
-
#product_properties ⇒ Object
readonly
Returns the value of attribute product_properties.
Instance Method Summary collapse
-
#initialize(property:, product_properties:) ⇒ PropertyPresenter
constructor
A new instance of PropertyPresenter.
- #to_h ⇒ Object
- #uniq_values ⇒ Object
Constructor Details
#initialize(property:, product_properties:) ⇒ PropertyPresenter
Returns a new instance of PropertyPresenter.
4 5 6 7 |
# File 'app/presenters/spree/filters/property_presenter.rb', line 4 def initialize(property:, product_properties:) @property = property @product_properties = product_properties end |
Instance Attribute Details
#product_properties ⇒ Object (readonly)
Returns the value of attribute product_properties.
9 10 11 |
# File 'app/presenters/spree/filters/property_presenter.rb', line 9 def product_properties @product_properties end |
Instance Method Details
#to_h ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'app/presenters/spree/filters/property_presenter.rb', line 17 def to_h { id: property.id, name: property.name, presentation: property.presentation, values: values_hash } end |
#uniq_values ⇒ Object
13 14 15 |
# File 'app/presenters/spree/filters/property_presenter.rb', line 13 def uniq_values property.uniq_values(product_properties_scope: product_properties) end |