Sha256: 07741fdf1d4f31ca3485a3c990b6ef67ba7f100e6f2032e51b12050369b20f51

Contents?: true

Size: 429 Bytes

Versions: 33

Compression:

Stored size: 429 Bytes

Contents

# frozen_string_literal: true

require "active_model"

module StoreModel
  module Types
    # Implements ActiveModel::Type::Value type for handling an array of
    # StoreModel::Model
    class OneOf
      def initialize(&block)
        @block = block
      end

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

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

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
store_model-4.2.0 lib/store_model/types/one_of.rb
store_model-4.1.0 lib/store_model/types/one_of.rb
store_model-4.0.0 lib/store_model/types/one_of.rb
store_model-3.0.2 lib/store_model/types/one_of.rb
store_model-3.0.1 lib/store_model/types/one_of.rb
store_model-3.0.0 lib/store_model/types/one_of.rb
store_model-2.4.0 lib/store_model/types/one_of.rb
store_model-2.3.0 lib/store_model/types/one_of.rb
store_model-2.2.0 lib/store_model/types/one_of.rb
store_model-2.1.2 lib/store_model/types/one_of.rb
store_model-2.1.1 lib/store_model/types/one_of.rb
store_model-2.1.0 lib/store_model/types/one_of.rb
store_model-2.0.1 lib/store_model/types/one_of.rb
store_model-2.0.0 lib/store_model/types/one_of.rb
store_model-1.6.2 lib/store_model/types/one_of.rb
store_model-1.6.1 lib/store_model/types/one_of.rb
store_model-1.6.0 lib/store_model/types/one_of.rb
store_model-1.5.1 lib/store_model/types/one_of.rb
store_model-1.5.0 lib/store_model/types/one_of.rb
store_model-1.4.0 lib/store_model/types/one_of.rb