Class: Trax::Model::Attributes::Types::UuidArray
- Inherits:
-
Trax::Model::Attributes::Type
- Object
- Trax::Model::Attributes::Type
- Trax::Model::Attributes::Types::UuidArray
- Defined in:
- lib/trax/model/attributes/types/uuid_array.rb
Defined Under Namespace
Classes: Attribute, TypeCaster, Value
Class Method Summary collapse
Methods inherited from Trax::Model::Attributes::Type
Class Method Details
.define_attribute(klass, attribute_name, **options, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/trax/model/attributes/types/uuid_array.rb', line 6 def self.define_attribute(klass, attribute_name, **, &block) klass_name = "#{klass.fields_module.name.underscore}/#{attribute_name}".camelize attribute_klass = if .key?(:class_name) [:class_name].constantize else ::Trax::Core::NamedClass.new(klass_name, Value, :parent_definition => klass, &block) end attribute_klass.element_class = [:of] if .has_key?(:of) .has_key?(:default) ? self.default_value_for(attribute_name, [:default]) : [] klass.attribute(attribute_name, typecaster_klass.new(target_klass: attribute_klass)) end |