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.



159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/odin/types/schema.rb', line 159

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.



156
157
158
# File 'lib/odin/types/schema.rb', line 156

def base_type
  @base_type
end

#compositionObject (readonly)

Returns the value of attribute composition.



156
157
158
# File 'lib/odin/types/schema.rb', line 156

def composition
  @composition
end

#constraintsObject (readonly)

Returns the value of attribute constraints.



156
157
158
# File 'lib/odin/types/schema.rb', line 156

def constraints
  @constraints
end

#fieldsObject (readonly)

Returns the value of attribute fields.



156
157
158
# File 'lib/odin/types/schema.rb', line 156

def fields
  @fields
end

#intersection_typesObject (readonly)

Returns the value of attribute intersection_types.



156
157
158
# File 'lib/odin/types/schema.rb', line 156

def intersection_types
  @intersection_types
end

#nameObject (readonly)

Returns the value of attribute name.



156
157
158
# File 'lib/odin/types/schema.rb', line 156

def name
  @name
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



156
157
158
# File 'lib/odin/types/schema.rb', line 156

def namespace
  @namespace
end

#parent_typesObject (readonly)

Returns the value of attribute parent_types.



156
157
158
# File 'lib/odin/types/schema.rb', line 156

def parent_types
  @parent_types
end