Sha256: eb40e4e5868112a8cd6bbbc44cf546d77823ad9bed1a4494d2d262c47d3fbda4
Contents?: true
Size: 650 Bytes
Versions: 1
Compression:
Stored size: 650 Bytes
Contents
# frozen_string_literal: true module Dry module Logic module Operations class Each < Unary def type :each end def call(input) results = input.map { |element| rule.(element) } success = results.all?(&:success?) Result.new(success, id) do failures = results .map .with_index { |result, idx| [:key, [idx, result.ast(input[idx])]] if result.failure? } .compact [:set, failures] end end def [](arr) arr.all? { |input| rule[input] } end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dry-logic-1.6.0 | lib/dry/logic/operations/each.rb |