Class: Gecko::Record::Variant
Defined Under Namespace
Classes: VariantLocation, VariantPrice
Instance Method Summary collapse
-
#display_name ⇒ String
Returns a display name for a variant.
Methods inherited from Base
demodulized_name, #initialize, #persisted?, #save
Methods included from LiquidCompatibility
Methods included from Helpers::ValidationHelper
Methods included from Helpers::SerializationHelper
#_serialize, #as_json, #root, #serializable_hash, #serialize_attribute, #writeable?
Methods included from Helpers::InspectionHelper
Methods included from Helpers::AssociationHelper
Constructor Details
This class inherits a constructor from Gecko::Record::Base
Instance Method Details
#display_name ⇒ String
Returns a display name for a variant
88 89 90 91 92 93 94 95 |
# File 'lib/gecko/record/variant.rb', line 88 def display_name parts = if name.nil? || !name.include?(product_name) [sku, product_name, name] else [sku, name] end parts.select { |part| part&.length }.join(' - ') end |