Sha256: da6e21bccc11d1e8057f559dc13cf15210d893d0ddaff3ab7ccd65ac794d3247

Contents?: true

Size: 455 Bytes

Versions: 7

Compression:

Stored size: 455 Bytes

Contents

# frozen_string_literal: true

module Strict
  module Validators
    class AllOf
      attr_reader :subvalidators

      def initialize(*subvalidators)
        @subvalidators = subvalidators
      end

      def ===(value)
        subvalidators.all? do |subvalidator|
          subvalidator === value
        end
      end

      def inspect
        "AllOf(#{subvalidators.map(&:inspect).join(', ')})"
      end
      alias to_s inspect
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
strict-1.5.0 lib/strict/validators/all_of.rb
strict-1.4.0 lib/strict/validators/all_of.rb
strict-1.3.1 lib/strict/validators/all_of.rb
strict-1.3.0 lib/strict/validators/all_of.rb
strict-1.2.0 lib/strict/validators/all_of.rb
strict-1.1.0 lib/strict/validators/all_of.rb
strict-1.0.0 lib/strict/validators/all_of.rb