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.



286
287
288
289
# File 'lib/groonga/expression-builder.rb', line 286

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

Instance Method Details

#=~(query) ⇒ Object



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

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

#build(expression, variable) ⇒ Object



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

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