Sha256: 450323397ea7b981752a7bfd34df45339f7f8477ceac656b71ad9d9e114c40b9

Contents?: true

Size: 471 Bytes

Versions: 4

Compression:

Stored size: 471 Bytes

Contents

require 'dry/logic/rule'

module Dry
  module Logic
    class Rule::Predicate < Rule
      def type
        :predicate
      end

      def name
        predicate.name
      end

      def to_s
        if args.size > 0
          "#{name}(#{args.map(&:inspect).join(', ')})"
        else
          "#{name}"
        end
      end

      def ast(input = Undefined)
        [type, [name, args_with_names(input)]]
      end
      alias_method :to_ast, :ast
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dry-logic-0.5.0 lib/dry/logic/rule/predicate.rb
dry-logic-0.4.2 lib/dry/logic/rule/predicate.rb
dry-logic-0.4.1 lib/dry/logic/rule/predicate.rb
dry-logic-0.4.0 lib/dry/logic/rule/predicate.rb