Module: Taro::Types::Shared::ItemType

Included in:
EnumType, ListType, ObjectTypes::PageType
Defined in:
lib/taro/types/shared/item_type.rb

Overview

Provides coercion and validation for the “inner” type of enums and arrays.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#item_typeObject

Returns the value of attribute item_type.



3
4
5
# File 'lib/taro/types/shared/item_type.rb', line 3

def item_type
  @item_type
end

Instance Method Details

#raise_mixed_types(new_type) ⇒ Object



11
12
13
14
15
16
# File 'lib/taro/types/shared/item_type.rb', line 11

def raise_mixed_types(new_type)
  raise Taro::ArgumentError, <<~MSG
    All items must be of the same type. Mixed types are not supported for now.
    Expected another #{item_type} item but got a #{new_type} for #{self}.
  MSG
end