Skip to content

Instantly share code, notes, and snippets.

@frsyuki
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frsyuki/0af8ba1535a15e65f686 to your computer and use it in GitHub Desktop.
Save frsyuki/0af8ba1535a15e65f686 to your computer and use it in GitHub Desktop.
def self.transaction(config, &control)
task = {
'charset' => 'utf-8',
'newline' => 'CRLF', # or LF
}
# ...
yield(task)
end
def run(file_input)
decoder_task = @task.load_config(Java::LineDecoder::DecoderTask)
decoder = Java::LineDecoder.new(file_input.instance_eval { @java_file_input }, decoder_task)
while decoder.nextFile
puts "parsing a file started"
while line = decoder.poll
puts "line: #{line}"
end
puts "parsing a file ended"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment