Sha256: db1d2714f6b6def78462fbc2ae6a258be17992c9fd625142704a9a426b43d719

Contents?: true

Size: 697 Bytes

Versions: 6

Compression:

Stored size: 697 Bytes

Contents

module Groonga
  module ExpressionTree
    class Constant
      attr_reader :value
      def initialize(value)
        # Groonga::Bulk, Groonga::Vector or raw Ruby object.
        # Should we unify to Groonga::*?
        @value = value
      end

      def build(expression)
        expression.append_constant(@value, Operator::PUSH, 1)
      end

      def estimatable?
        true
      end

      def estimate_size(table)
        if true_value?
          table.size
        else
          0
        end
      end

      private
      def true_value?
        if @value.respond_to?(:true?)
          @value.true?
        else
          Bulk.true?(@value)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rroonga-9.0.7-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/constant.rb
rroonga-9.0.7-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/constant.rb
rroonga-9.0.3-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/constant.rb
rroonga-9.0.3-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/constant.rb
rroonga-9.0.2-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/constant.rb
rroonga-9.0.2-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/constant.rb