Class: Groonga::RecordExpressionBuilder

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

Overview

:nodoc:

Instance Attribute Summary

Attributes included from ExpressionBuildable

#allow_column, #allow_pragma, #allow_update, #default_column, #query, #syntax, #table

Instance Method Summary collapse

Methods included from ExpressionBuildable

#&, #build, #|

Constructor Details

#initialize(table, name) ⇒ RecordExpressionBuilder

Returns a new instance of RecordExpressionBuilder.



198
199
200
201
202
# File 'lib/groonga/expression-builder.rb', line 198

def initialize(table, name)
  super()
  @table = table
  @name = name
end

Instance Method Details

#[](name) ⇒ Object



204
205
206
207
208
209
210
211
212
213
214
# File 'lib/groonga/expression-builder.rb', line 204

def [](name)
  column = @table.column(name)
  if column.nil?
    message = "unknown column <#{name.inspect}> " +
      "for table <#{@table.inspect}>"
    raise ArgumentError, message
  end
  ColumnExpressionBuilder.new(column, nil, nil,
                              :table => @table,
                              :column_name => name)
end

#match(query, options_or_default_column = {}) ⇒ Object



216
217
218
219
220
221
222
223
224
225
# File 'lib/groonga/expression-builder.rb', line 216

def match(query, options_or_default_column={})
  if options_or_default_column.is_a?(String)
    options = {:default_column => options_or_default_column}
  else
    options = options_or_default_column
  end
  options = options.dup
  options[:syntax] ||= :query
  SubExpressionBuilder.new(query, options)
end