Class: CoreLibrary::UnionTypeContext

Inherits:
Object
  • Object
show all
Defined in:
lib/apimatic-core/types/union_types/union_type_context.rb

Overview

Represents the context for a UnionType

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(is_array: false, is_dict: false, is_array_of_dict: false, is_optional: false, is_nullable: false, discriminator: nil, discriminator_value: nil, date_time_format: nil, date_time_converter: nil) ⇒ UnionTypeContext

Initializes a new instance of UnionTypeContext



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/apimatic-core/types/union_types/union_type_context.rb', line 10

def initialize(is_array: false, is_dict: false, is_array_of_dict: false, is_optional: false, is_nullable: false,
               discriminator: nil, discriminator_value: nil, date_time_format: nil, date_time_converter: nil)
  @is_array = is_array
  @is_dict = is_dict
  @is_array_of_dict = is_array_of_dict
  @is_optional = is_optional
  @is_nullable = is_nullable
  @discriminator = discriminator
  @discriminator_value = discriminator_value
  @date_time_format = date_time_format
  @date_time_converter = date_time_converter
  @is_nested = false
end

Instance Attribute Details

#date_time_converterObject (readonly)

Returns the value of attribute date_time_converter.



4
5
6
# File 'lib/apimatic-core/types/union_types/union_type_context.rb', line 4

def date_time_converter
  @date_time_converter
end

#date_time_formatObject (readonly)

Returns the value of attribute date_time_format.



4
5
6
# File 'lib/apimatic-core/types/union_types/union_type_context.rb', line 4

def date_time_format
  @date_time_format
end

#discriminatorObject

Returns the value of attribute discriminator.



7
8
9
# File 'lib/apimatic-core/types/union_types/union_type_context.rb', line 7

def discriminator
  @discriminator
end

#discriminator_valueObject

Returns the value of attribute discriminator_value.



7
8
9
# File 'lib/apimatic-core/types/union_types/union_type_context.rb', line 7

def discriminator_value
  @discriminator_value
end

#is_arrayObject (readonly)

Returns the value of attribute is_array.



4
5
6
# File 'lib/apimatic-core/types/union_types/union_type_context.rb', line 4

def is_array
  @is_array
end

#is_array_of_dictObject (readonly)

Returns the value of attribute is_array_of_dict.



4
5
6
# File 'lib/apimatic-core/types/union_types/union_type_context.rb', line 4

def is_array_of_dict
  @is_array_of_dict
end

#is_dictObject (readonly)

Returns the value of attribute is_dict.



4
5
6
# File 'lib/apimatic-core/types/union_types/union_type_context.rb', line 4

def is_dict
  @is_dict
end

#is_nestedObject

Returns the value of attribute is_nested.



7
8
9
# File 'lib/apimatic-core/types/union_types/union_type_context.rb', line 7

def is_nested
  @is_nested
end

#is_nullableObject (readonly)

Returns the value of attribute is_nullable.



4
5
6
# File 'lib/apimatic-core/types/union_types/union_type_context.rb', line 4

def is_nullable
  @is_nullable
end

#is_optionalObject (readonly)

Returns the value of attribute is_optional.



4
5
6
# File 'lib/apimatic-core/types/union_types/union_type_context.rb', line 4

def is_optional
  @is_optional
end

Instance Method Details

#nullable_or_optional?Boolean

Determines if the UnionTypeContext is nullable or optional

Returns:

  • (Boolean)

    True if the context is nullable or optional, false otherwise



26
27
28
# File 'lib/apimatic-core/types/union_types/union_type_context.rb', line 26

def nullable_or_optional?
  @is_nullable || @is_optional
end