Class: ProductTaxonomy::ExtendedAttribute
- Defined in:
- lib/product_taxonomy/models/extended_attribute.rb
Constant Summary
Constants included from Indexed
Instance Attribute Summary collapse
-
#values_from ⇒ Object
(also: #base_attribute)
readonly
Returns the value of attribute values_from.
Attributes inherited from Attribute
#extended_attributes, #friendly_id, #handle, #id, #values
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, handle:, description:, friendly_id:, values_from:) ⇒ ExtendedAttribute
constructor
A new instance of ExtendedAttribute.
Methods inherited from Attribute
#add_extended_attribute, #add_value, #extended?, #gid, load_from_source, #manually_sorted?, next_id, reset, sorted_base_attributes, #sorted_values
Methods included from Localized
#localizations, #validate_localizations!
Methods included from Indexed
#add, #all, #create_validate_and_add!, #duplicate?, extended, #find_by, #find_by!, #hashed_by, #hashed_models, #size
Methods included from FormattedValidationErrors
Constructor Details
#initialize(name:, handle:, description:, friendly_id:, values_from:) ⇒ ExtendedAttribute
Returns a new instance of ExtendedAttribute.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/product_taxonomy/models/extended_attribute.rb', line 23 def initialize(name:, handle:, description:, friendly_id:, values_from:) @values_from = values_from values_from.add_extended_attribute(self) if values_from.is_a?(Attribute) super( id: values_from.try(:id), name:, handle:, description:, friendly_id:, values: values_from.try(:values), is_manually_sorted: values_from.try(:manually_sorted?) || false, ) end |
Instance Attribute Details
#values_from ⇒ Object (readonly) Also known as: base_attribute
Returns the value of attribute values_from.
13 14 15 |
# File 'lib/product_taxonomy/models/extended_attribute.rb', line 13 def values_from @values_from end |
Class Method Details
.localizations ⇒ Object
6 7 8 |
# File 'lib/product_taxonomy/models/extended_attribute.rb', line 6 def localizations superclass.localizations # Extended attribute localizations are defined in the same place as attributes end |