Class: Peddler::FlatFileParser Private
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Peddler::FlatFileParser
- Includes:
- Headers
- Defined in:
- lib/peddler/flat_file_parser.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #content ⇒ Object readonly private
- #summary ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(res, encoding) ⇒ FlatFileParser
constructor
private
A new instance of FlatFileParser.
- #parse(&blk) ⇒ Object private
- #records_count ⇒ Object private
- #valid? ⇒ Boolean private
Methods included from Headers
#mws_quota_max, #mws_quota_remaining, #mws_quota_resets_on, #mws_request_id, #mws_response_context, #mws_timestamp
Constructor Details
#initialize(res, encoding) ⇒ FlatFileParser
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of FlatFileParser.
19 20 21 22 23 |
# File 'lib/peddler/flat_file_parser.rb', line 19 def initialize(res, encoding) super(res) scrub_body!(encoding) extract_content_and_summary end |
Instance Attribute Details
#content ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 |
# File 'lib/peddler/flat_file_parser.rb', line 17 def content @content end |
#summary ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 |
# File 'lib/peddler/flat_file_parser.rb', line 17 def summary @summary end |
Instance Method Details
#parse(&blk) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 |
# File 'lib/peddler/flat_file_parser.rb', line 25 def parse(&blk) CSV.parse(content, OPTIONS, &blk) unless content.empty? end |
#records_count ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 |
# File 'lib/peddler/flat_file_parser.rb', line 29 def records_count summarize if summary end |
#valid? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 |
# File 'lib/peddler/flat_file_parser.rb', line 33 def valid? headers['Content-MD5'] == Digest::MD5.base64digest(body) end |