lib/peddler/flat_file_parser.rb in peddler-0.8.0 vs lib/peddler/flat_file_parser.rb in peddler-0.9.0
- old
+ new
@@ -19,31 +19,31 @@
def parse
CSV.parse(scrub_content, OPTIONS) if content
end
def records_count
- summarize if has_summary?
+ summarize if summary?
end
def valid?
headers['Content-MD5'] == Digest::MD5.base64digest(body)
end
private
def extract_content
- if has_summary?
+ if summary?
@summary, @content = body.split("\n\n")
else
@content = body.dup
end
end
def scrub_content
content.force_encoding(encoding).encode('UTF-8')
end
- def has_summary?
+ def summary?
body.start_with?('Feed Processing Summary')
end
def summarize
Hash[summary.split("\n\t")[1, 2].map { |line| line.split("\t\t") }]