Class: Embulk::FormatterPlugin::JavaAdapter::OutputAdapter

Inherits:
Object
  • Object
show all
Includes:
Java::TransactionalPageOutput
Defined in:
lib/embulk/formatter_plugin.rb

Instance Method Summary collapse

Constructor Details

#initialize(ruby_object, schema, file_output) ⇒ OutputAdapter

Returns a new instance of OutputAdapter.



69
70
71
72
73
# File 'lib/embulk/formatter_plugin.rb', line 69

def initialize(ruby_object, schema, file_output)
  @ruby_object = ruby_object
  @schema = schema
  @file_output = file_output
end

Instance Method Details

#add(java_page) ⇒ Object



75
76
77
78
# File 'lib/embulk/formatter_plugin.rb', line 75

def add(java_page)
  # TODO reuse page reader
  @ruby_object.add Page.new(java_page, @schema)
end

#closeObject



84
85
86
87
88
# File 'lib/embulk/formatter_plugin.rb', line 84

def close
  @ruby_object.close
ensure
  @file_output.close
end

#finishObject



80
81
82
# File 'lib/embulk/formatter_plugin.rb', line 80

def finish
  @ruby_object.finish
end