Sha256: f249e2ab59d36b55dab40de39953e69f2cef54605d51f5bd598386678cde60bb

Contents?: true

Size: 413 Bytes

Versions: 5

Compression:

Stored size: 413 Bytes

Contents

module Dry
  module Logic
    class Rule::Set < Rule
      def call(input)
        Logic.Result(input, predicate.map { |rule| rule.(input) }, self)
      end

      def type
        :set
      end

      def at(*args)
        self.class.new(name, predicate.values_at(*args))
      end

      def to_ary
        [type, [name, predicate.map(&:to_ary)]]
      end
      alias_method :to_a, :to_ary
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dry-logic-0.1.4 lib/dry/logic/rule/set.rb
dry-logic-0.1.3 lib/dry/logic/rule/set.rb
dry-logic-0.1.2 lib/dry/logic/rule/set.rb
dry-logic-0.1.1 lib/dry/logic/rule/set.rb
dry-logic-0.1.0 lib/dry/logic/rule/set.rb