Class: StoreModel::Types::OneOf

Inherits:
Object
  • Object
show all
Defined in:
lib/store_model/types/one_of.rb

Overview

Implements ActiveModel::Type::Value type for handling an array of StoreModel::Model

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ OneOf

Returns a new instance of OneOf.



10
11
12
# File 'lib/store_model/types/one_of.rb', line 10

def initialize(&block)
  @block = block
end

Instance Method Details

#to_array_typeObject



18
19
20
# File 'lib/store_model/types/one_of.rb', line 18

def to_array_type
  Types::ManyPolymorphic.new(@block)
end

#to_hash_typeObject



22
23
24
# File 'lib/store_model/types/one_of.rb', line 22

def to_hash_type
  Types::HashPolymorphic.new(@block)
end

#to_typeObject



14
15
16
# File 'lib/store_model/types/one_of.rb', line 14

def to_type
  Types::OnePolymorphic.new(@block)
end