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

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

Constant Summary

Instance Method Summary (collapse)

Constructor Details

- (TypeGuesser) initialize(sample_values)

Returns a new instance of TypeGuesser



163
164
165
# File 'lib/fluent/plugin/out_groonga.rb', line 163

def initialize(sample_values)
  @sample_values = sample_values
end

Instance Method Details

- (Object) guess



167
168
169
170
171
172
173
174
175
# File 'lib/fluent/plugin/out_groonga.rb', line 167

def guess
  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?

  "Text"
end

- (Boolean) vector?

Returns:

  • (Boolean)


177
178
179
180
181
# File 'lib/fluent/plugin/out_groonga.rb', line 177

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