Class: TypedData::Schema::EnumType

Inherits:
Type
  • Object
show all
Defined in:
lib/typed_data/schema/enum_type.rb

Constant Summary

Constants inherited from Type

Type::SUPPORTED_LOGICAL_TYPES

Instance Method Summary collapse

Methods inherited from Type

#accept, #to_s

Constructor Details

#initialize(name, symbols) ⇒ EnumType

Returns a new instance of EnumType.



6
7
8
9
# File 'lib/typed_data/schema/enum_type.rb', line 6

def initialize(name, symbols)
  @name = name
  @symbols = symbols
end

Instance Method Details

#match?(value) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/typed_data/schema/enum_type.rb', line 15

def match?(value)
  @symbols.include?(value)
end

#primitive?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/typed_data/schema/enum_type.rb', line 11

def primitive?
  false
end