Sha256: c71057fd434b265dbd30bef63e86e00a1c5bd22144c7936c5cce81a433dce769

Contents?: true

Size: 588 Bytes

Versions: 5

Compression:

Stored size: 588 Bytes

Contents

class Predicate
  module Literal
    include Expr

    def priority
      100
    end

    def free_variables
      @free_variables ||= []
    end

    def value
      last
    end

    def has_placeholder?
      value.is_a?(Placeholder)
    end

    def empty_value?
      return false if has_placeholder?
      value.respond_to?(:empty?) && value.empty?
    end

    def singleton_value?
      return false if has_placeholder?
      value.respond_to?(:size) && value.size == 1
    end

    def evaluate(tuple)
      raise UnboundError if has_placeholder?
      value
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
predicate-2.4.0 lib/predicate/nodes/literal.rb
predicate-2.3.3 lib/predicate/nodes/literal.rb
predicate-2.3.2 lib/predicate/nodes/literal.rb
predicate-2.3.1 lib/predicate/nodes/literal.rb
predicate-2.3.0 lib/predicate/nodes/literal.rb