Class: Groonga::ExpressionBuildable::MatchTargetExpressionBuilder

Inherits:
ExpressionBuilder
  • Object
show all
Defined in:
lib/groonga/expression-builder.rb

Instance Method Summary collapse

Methods inherited from ExpressionBuilder

#&, #|

Constructor Details

#initialize(target) ⇒ MatchTargetExpressionBuilder

Returns a new instance of MatchTargetExpressionBuilder.



288
289
290
291
# File 'lib/groonga/expression-builder.rb', line 288

def initialize(target)
  super()
  @target = target
end

Instance Method Details

#=~(query) ⇒ Object



299
300
301
302
303
304
# File 'lib/groonga/expression-builder.rb', line 299

def =~(query)
  if query.nil?
    raise ArgumentError, "match word should not be nil"
  end
  MatchExpressionBuilder.new(self, query)
end

#build(expression, variable) ⇒ Object



293
294
295
296
297
# File 'lib/groonga/expression-builder.rb', line 293

def build(expression, variable)
  expression.append_object(variable)
  expression.append_object(@target)
  expression.append_operation(Groonga::Operation::GET_VALUE, 2)
end