Class: Odin::Types::SchemaType

Inherits:
Object
  • Object
show all
Defined in:
lib/odin/types/schema.rb

Overview

Schema type definition (named object structure)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, fields: {}, namespace: nil, composition: nil, base_type: nil, constraints: nil, intersection_types: nil, parent_types: nil) ⇒ SchemaType

Returns a new instance of SchemaType.



142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/odin/types/schema.rb', line 142

def initialize(name:, fields: {}, namespace: nil, composition: nil,
               base_type: nil, constraints: nil, intersection_types: nil,
               parent_types: nil)
  @name = name.freeze
  @fields = fields.freeze
  @namespace = namespace&.freeze
  @composition = composition
  @base_type = base_type
  @constraints = (constraints || {}).freeze
  @intersection_types = intersection_types&.freeze
  @parent_types = parent_types&.freeze
  freeze
end

Instance Attribute Details

#base_typeObject (readonly)

Returns the value of attribute base_type.



139
140
141
# File 'lib/odin/types/schema.rb', line 139

def base_type
  @base_type
end

#compositionObject (readonly)

Returns the value of attribute composition.



139
140
141
# File 'lib/odin/types/schema.rb', line 139

def composition
  @composition
end

#constraintsObject (readonly)

Returns the value of attribute constraints.



139
140
141
# File 'lib/odin/types/schema.rb', line 139

def constraints
  @constraints
end

#fieldsObject (readonly)

Returns the value of attribute fields.



139
140
141
# File 'lib/odin/types/schema.rb', line 139

def fields
  @fields
end

#intersection_typesObject (readonly)

Returns the value of attribute intersection_types.



139
140
141
# File 'lib/odin/types/schema.rb', line 139

def intersection_types
  @intersection_types
end

#nameObject (readonly)

Returns the value of attribute name.



139
140
141
# File 'lib/odin/types/schema.rb', line 139

def name
  @name
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



139
140
141
# File 'lib/odin/types/schema.rb', line 139

def namespace
  @namespace
end

#parent_typesObject (readonly)

Returns the value of attribute parent_types.



139
140
141
# File 'lib/odin/types/schema.rb', line 139

def parent_types
  @parent_types
end