-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split up json #70
Split up json #70
Conversation
This gets arbitratry files from an sftp server, puts it in a local directory, can delete the local directory later
include Traject::Macros::Marc21Semantics | ||
def initialize(raw) | ||
@raw = raw | ||
@record = MARC::JSONLReader.new(StringIO.new(@raw)).first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be MARC::Record.new_from_hash(JSON.parse(@raw))
S.logger.info "Writing filtered records from #{full_zephir_file} to the #{scratch_dir} directory" | ||
Zinzout.zin(full_zephir_file) do |infile| | ||
# count = 0 | ||
infile.each.each_slice(batch_size) do |lines| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can just use each_slice
|
||
@line_count = 0 | ||
@file_count = 0 | ||
_update_current_file_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turn these into functions that take what they need and return a string, so you end up with
@current_file_path = _update_current_file_path(blah blah gblah)
No description provided.