Sha256: e3723cf8f1fc83369589c0d371fae5705c76fbfa5b123a89b07a4e97f3861ee1

Contents?: true

Size: 378 Bytes

Versions: 4

Compression:

Stored size: 378 Bytes

Contents

module Dry
  module Logic
    class Rule::Attr < Rule
      def self.new(name, predicate)
        super(name, predicate.curry(name))
      end

      def type
        :attr
      end

      def evaluate_input(input)
        input.public_send(name)
      end

      def call(input)
        Logic::Result::LazyValue.new(input, predicate.(input), self)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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