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-1.3.0 lib/store_model/types/one_of.rb
store_model-1.2.0 lib/store_model/types/one_of.rb
store_model-1.1.0 lib/store_model/types/one_of.rb
store_model-1.0.0 lib/store_model/types/one_of.rb
store_model-0.13.0 lib/store_model/types/one_of.rb
store_model-0.12.0 lib/store_model/types/one_of.rb
store_model-0.11.1 lib/store_model/types/one_of.rb
store_model-0.11.0 lib/store_model/types/one_of.rb
store_model-0.10.0 lib/store_model/types/one_of.rb
store_model-0.9.0 lib/store_model/types/one_of.rb
store_model-0.8.2 lib/store_model/types/one_of.rb
store_model-0.8.1 lib/store_model/types/one_of.rb
store_model-0.8.0 lib/store_model/types/one_of.rb