Module: Sheetah::AttributeTypes

Defined in:
lib/sheetah/attribute_types.rb,
lib/sheetah/attribute_types/value.rb,
lib/sheetah/attribute_types/scalar.rb,
lib/sheetah/attribute_types/composite.rb

Defined Under Namespace

Classes: Composite, Scalar, Value

Class Method Summary collapse

Class Method Details

.build(type) ⇒ Object

A factory for all Sheetah::AttributeType.



9
10
11
12
13
14
15
16
17
# File 'lib/sheetah/attribute_types.rb', line 9

def self.build(type)
  if type.is_a?(Hash) && type.key?(:composite)
    Composite.build(**type)
  elsif type.is_a?(Array)
    Composite.build(composite: :array, scalars: type)
  else
    Scalar.build(type)
  end
end