Sha256: d645568a9d344e9bf47d7d5380eb0e1dbc64e2b8fe1445fff1b914cb7c396af4

Contents?: true

Size: 374 Bytes

Versions: 4

Compression:

Stored size: 374 Bytes

Contents

module Dry
  module Logic
    class Rule::Value < Rule
      def type
        :val
      end

      def call(input)
        Logic.Result(apply(input), self, input)
      end

      def apply(input)
        predicate.(evaluate(input))
      end

      def evaluate(input)
        input
      end

      def to_ast
        [type, predicate.to_ast]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dry-logic-0.2.3 lib/dry/logic/rule/value.rb
dry-logic-0.2.2 lib/dry/logic/rule/value.rb
dry-logic-0.2.1 lib/dry/logic/rule/value.rb
dry-logic-0.2.0 lib/dry/logic/rule/value.rb