class Embulk::Column
Public Class Methods
from_java(java_column)
click to toggle source
# File lib/embulk/column.rb, line 23 def self.from_java(java_column) type = Type.from_java(java_column.getType) if type == :timestamp format = java_column.getType.getFormat else format = nil end Column.new(java_column.getIndex, java_column.getName, type, format) end
new(*args)
click to toggle source
Calls superclass method
# File lib/embulk/column.rb, line 4 def initialize(*args) if args.length == 1 && args[0].is_a?(Hash) # initialize(hash) hash = args.first super(hash[:index], hash[:name], hash[:type], hash[:format]) else # initialize(index, name, type, format) super(*args) end end
Public Instance Methods
to_java()
click to toggle source
# File lib/embulk/column.rb, line 34 def to_java if type == :timestamp && format Java::Column.new(index, name, Type.new_java_type(type).withFormat(format)) else Java::Column.new(index, name, Type.new_java_type(type)) end end
to_json(*args)
click to toggle source
# File lib/embulk/column.rb, line 15 def to_json(*args) if type == :timestamp && format {"index"=>index, "name"=>name, "type"=>type, "format"=>format}.to_json(*args) else {"index"=>index, "name"=>name, "type"=>type}.to_json(*args) end end