Class: StoreModel::Types::OneOf
- Inherits:
-
Object
- Object
- StoreModel::Types::OneOf
- 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
-
#initialize(&block) ⇒ OneOf
constructor
A new instance of OneOf.
- #to_array_type ⇒ Object
- #to_hash_type ⇒ Object
- #to_type ⇒ Object
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_type ⇒ Object
18 19 20 |
# File 'lib/store_model/types/one_of.rb', line 18 def to_array_type Types::ManyPolymorphic.new(@block) end |
#to_hash_type ⇒ Object
22 23 24 |
# File 'lib/store_model/types/one_of.rb', line 22 def to_hash_type Types::HashPolymorphic.new(@block) end |
#to_type ⇒ Object
14 15 16 |
# File 'lib/store_model/types/one_of.rb', line 14 def to_type Types::OnePolymorphic.new(@block) end |