Class: Fluent::GroongaOutput::Schema::TypeGuesser

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/out_groonga.rb

Instance Method Summary collapse

Constructor Details

#initialize(sample_values) ⇒ TypeGuesser

Returns a new instance of TypeGuesser.



406
407
408
# File 'lib/fluent/plugin/out_groonga.rb', line 406

def initialize(sample_values)
  @sample_values = sample_values
end

Instance Method Details

#guessObject



410
411
412
413
414
415
416
417
418
419
420
421
# File 'lib/fluent/plugin/out_groonga.rb', line 410

def guess
  return "Bool"          if bool_values?
  return "Time"          if time_values?
  return "Int32"         if int32_values?
  return "Int64"         if int64_values?
  return "Float"         if float_values?
  return "WGS84GeoPoint" if geo_point_values?
  return "LongText"      if long_text_values?
  return "Text"          if text_values?

  "ShortText"
end

#vector?Boolean

Returns:

  • (Boolean)


423
424
425
426
427
# File 'lib/fluent/plugin/out_groonga.rb', line 423

def vector?
  @sample_values.any? do |sample_value|
    sample_value.is_a?(Array)
  end
end