Sha256: 8d38c0c512f2860733a68321ecb28abd575327643beca57f1b27a6ce9675a508

Contents?: true

Size: 528 Bytes

Versions: 1

Compression:

Stored size: 528 Bytes

Contents

# frozen_string_literal: true

module LedgerSync
  module Type
    class ReferenceMany < Value # :nodoc:
      include ValueMixin

      attr_reader :resource_class

      def initialize(resource_class:)
        @resource_class = resource_class
        super()
      end

      def type
        :reference_many
      end

      def valid_without_casting?(value:)
        return false unless value.is_a?(Array)
        return true if value.reject { |e| e.is_a?(resource_class) }.empty?

        false
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ledger_sync-1.1.1 lib/ledger_sync/type/reference_many.rb