Class: Spree::CSV::ProductTranslationPresenter
- Inherits:
-
Object
- Object
- Spree::CSV::ProductTranslationPresenter
- Defined in:
- app/presenters/spree/csv/product_translation_presenter.rb
Constant Summary collapse
- CSV_HEADERS =
%w[ slug locale name description meta_title meta_description ].freeze
- TRANSLATABLE_FIELDS =
%i[name description meta_title meta_description].freeze
Instance Attribute Summary collapse
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#product ⇒ Object
readonly
Returns the value of attribute product.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(product, locale) ⇒ ProductTranslationPresenter
constructor
A new instance of ProductTranslationPresenter.
Constructor Details
#initialize(product, locale) ⇒ ProductTranslationPresenter
Returns a new instance of ProductTranslationPresenter.
15 16 17 18 |
# File 'app/presenters/spree/csv/product_translation_presenter.rb', line 15 def initialize(product, locale) @product = product @locale = locale.to_s end |
Instance Attribute Details
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
20 21 22 |
# File 'app/presenters/spree/csv/product_translation_presenter.rb', line 20 def locale @locale end |
#product ⇒ Object (readonly)
Returns the value of attribute product.
20 21 22 |
# File 'app/presenters/spree/csv/product_translation_presenter.rb', line 20 def product @product end |
Instance Method Details
#call ⇒ Object
22 23 24 25 26 27 28 |
# File 'app/presenters/spree/csv/product_translation_presenter.rb', line 22 def call [ product.slug, locale, *TRANSLATABLE_FIELDS.map { |field| product.get_field_with_locale(locale, field) } ] end |