Class: DbSchema::Definitions::Field::Array

Inherits:
Base
  • Object
show all
Defined in:
lib/db_schema/definitions/field/array.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#default, #name

Instance Method Summary collapse

Methods inherited from Base

attributes, #custom_type?, default_attribute_values, #null?, #options, #primary_key?, #process_default, register, #type, type, valid_attributes

Constructor Details

#initialize(name, of:, **options) ⇒ Array

Returns a new instance of Array.



8
9
10
11
# File 'lib/db_schema/definitions/field/array.rb', line 8

def initialize(name, of:, **options)
  super(name, **options)
  @element_type = Field.type_class_for(of)
end

Instance Attribute Details

#element_typeObject (readonly)

Returns the value of attribute element_type.



6
7
8
# File 'lib/db_schema/definitions/field/array.rb', line 6

def element_type
  @element_type
end

Instance Method Details

#attributesObject



13
14
15
# File 'lib/db_schema/definitions/field/array.rb', line 13

def attributes
  super.merge(element_type: element_type.type)
end