Class: Odin::Types::SchemaCardinality

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

Overview

Cardinality constraint (:of, :one_of, :exactly_one, :at_most_one)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cardinality_type:, fields:, min: nil, max: nil) ⇒ SchemaCardinality

Returns a new instance of SchemaCardinality.



229
230
231
232
233
234
235
236
# File 'lib/odin/types/schema.rb', line 229

def initialize(cardinality_type:, fields:, min: nil, max: nil)
  @kind = :cardinality
  @cardinality_type = cardinality_type.freeze
  @fields = fields.freeze
  @min = min
  @max = max
  freeze
end

Instance Attribute Details

#cardinality_typeObject (readonly)

Returns the value of attribute cardinality_type.



227
228
229
# File 'lib/odin/types/schema.rb', line 227

def cardinality_type
  @cardinality_type
end

#fieldsObject (readonly)

Returns the value of attribute fields.



227
228
229
# File 'lib/odin/types/schema.rb', line 227

def fields
  @fields
end

#kindObject (readonly)

Returns the value of attribute kind.



227
228
229
# File 'lib/odin/types/schema.rb', line 227

def kind
  @kind
end

#maxObject (readonly)

Returns the value of attribute max.



227
228
229
# File 'lib/odin/types/schema.rb', line 227

def max
  @max
end

#minObject (readonly)

Returns the value of attribute min.



227
228
229
# File 'lib/odin/types/schema.rb', line 227

def min
  @min
end