class RecordSchema
Public Class Methods
new()
click to toggle source
# File lib/fluent/plugin/datahub/datahub-record-schema.rb, line 28 def initialize() @fields = [] @encoding = nil @fields_map = {} end
Public Instance Methods
add_field(field)
click to toggle source
# File lib/fluent/plugin/datahub/datahub-record-schema.rb, line 48 def add_field(field) @fields.push(field) @fields_map[field.get_name] = field end
get_encoding()
click to toggle source
# File lib/fluent/plugin/datahub/datahub-record-schema.rb, line 44 def get_encoding return @encoding end
get_field(name)
click to toggle source
# File lib/fluent/plugin/datahub/datahub-record-schema.rb, line 53 def get_field(name) # @fields.each do |field| # if field.get_name == name # return field # end # end # return nil return @fields_map[name] end
get_fields()
click to toggle source
# File lib/fluent/plugin/datahub/datahub-record-schema.rb, line 63 def get_fields() return @fields end
setEncoding(encoding)
click to toggle source
# File lib/fluent/plugin/datahub/datahub-record-schema.rb, line 36 def setEncoding(encoding) if ["US-ASCII", "ASCII-8BIT", "UTF-8", "ISO-8859-1", "Shift_JIS", "EUC-JP", "Windows-31J", "BINARY", "CP932", "eucJP"].include?(encoding) @encoding = encoding else raise "Unsupported encoding type [" + encoding.to_s + "]." end end
to_json(*a)
click to toggle source
# File lib/fluent/plugin/datahub/datahub-record-schema.rb, line 67 def to_json(*a) tuple = {} tuple["fields"] = @fields tuple.to_json(*a) end