Sha256: 00a6743b81b3c15f586e71acb1c542b8752e35f3820718d44c5ebbea4d4dd998

Contents?: true

Size: 1001 Bytes

Versions: 12

Compression:

Stored size: 1001 Bytes

Contents

require_relative './operation'

module Dentaku
  module AST
    class Comparator < Operation
      def self.precedence
        5
      end

      def type
        :logical
      end
    end

    class LessThan < Comparator
      def value(context={})
        left.value(context) < right.value(context)
      end
    end

    class LessThanOrEqual < Comparator
      def value(context={})
        left.value(context) <= right.value(context)
      end
    end

    class GreaterThan < Comparator
      def value(context={})
        left.value(context) > right.value(context)
      end
    end

    class GreaterThanOrEqual < Comparator
      def value(context={})
        left.value(context) >= right.value(context)
      end
    end

    class NotEqual < Comparator
      def value(context={})
        left.value(context) != right.value(context)
      end
    end

    class Equal < Comparator
      def value(context={})
        left.value(context) == right.value(context)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
dentaku-3.0.0 lib/dentaku/ast/comparators.rb
dentaku-2.0.11 lib/dentaku/ast/comparators.rb
dentaku-2.0.10 lib/dentaku/ast/comparators.rb
dentaku-2.0.9 lib/dentaku/ast/comparators.rb
dentaku-2.0.8 lib/dentaku/ast/comparators.rb
dentaku-2.0.7 lib/dentaku/ast/comparators.rb
dentaku-2.0.6 lib/dentaku/ast/comparators.rb
dentaku-2.0.5 lib/dentaku/ast/comparators.rb
dentaku-2.0.4 lib/dentaku/ast/comparators.rb
dentaku-2.0.3 lib/dentaku/ast/comparators.rb
dentaku-2.0.2 lib/dentaku/ast/comparators.rb
dentaku-2.0.1 lib/dentaku/ast/comparators.rb