iostreams 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/Rakefile +7 -7
- data/lib/io_streams/builder.rb +4 -3
- data/lib/io_streams/bzip2/reader.rb +1 -1
- data/lib/io_streams/bzip2/writer.rb +1 -1
- data/lib/io_streams/deprecated.rb +2 -3
- data/lib/io_streams/encode/reader.rb +5 -8
- data/lib/io_streams/encode/writer.rb +1 -1
- data/lib/io_streams/io_streams.rb +5 -2
- data/lib/io_streams/line/reader.rb +2 -1
- data/lib/io_streams/path.rb +4 -4
- data/lib/io_streams/paths/http.rb +8 -10
- data/lib/io_streams/paths/matcher.rb +10 -11
- data/lib/io_streams/paths/s3.rb +6 -6
- data/lib/io_streams/paths/sftp.rb +38 -23
- data/lib/io_streams/pgp.rb +45 -35
- data/lib/io_streams/pgp/reader.rb +4 -6
- data/lib/io_streams/pgp/writer.rb +1 -2
- data/lib/io_streams/reader.rb +2 -2
- data/lib/io_streams/record/writer.rb +2 -4
- data/lib/io_streams/row/writer.rb +3 -5
- data/lib/io_streams/stream.rb +6 -6
- data/lib/io_streams/symmetric_encryption/reader.rb +1 -3
- data/lib/io_streams/symmetric_encryption/writer.rb +2 -6
- data/lib/io_streams/tabular.rb +12 -10
- data/lib/io_streams/tabular/header.rb +4 -4
- data/lib/io_streams/tabular/parser/array.rb +2 -4
- data/lib/io_streams/tabular/parser/csv.rb +3 -5
- data/lib/io_streams/tabular/parser/fixed.rb +4 -3
- data/lib/io_streams/tabular/parser/hash.rb +2 -4
- data/lib/io_streams/tabular/parser/json.rb +2 -4
- data/lib/io_streams/tabular/parser/psv.rb +5 -7
- data/lib/io_streams/tabular/utility/csv_row.rb +9 -17
- data/lib/io_streams/utils.rb +3 -3
- data/lib/io_streams/utils/reliable_http.rb +98 -0
- data/lib/io_streams/version.rb +1 -1
- data/lib/io_streams/writer.rb +1 -1
- data/lib/io_streams/xlsx/reader.rb +5 -5
- data/lib/io_streams/zip/reader.rb +1 -1
- data/lib/io_streams/zip/writer.rb +2 -2
- data/lib/iostreams.rb +34 -34
- data/test/builder_test.rb +74 -74
- data/test/bzip2_reader_test.rb +8 -13
- data/test/bzip2_writer_test.rb +8 -9
- data/test/deprecated_test.rb +25 -29
- data/test/encode_reader_test.rb +14 -18
- data/test/encode_writer_test.rb +29 -30
- data/test/gzip_reader_test.rb +8 -13
- data/test/gzip_writer_test.rb +10 -11
- data/test/io_streams_test.rb +35 -35
- data/test/line_reader_test.rb +35 -39
- data/test/line_writer_test.rb +8 -9
- data/test/minimal_file_reader.rb +1 -1
- data/test/path_test.rb +24 -24
- data/test/paths/file_test.rb +42 -42
- data/test/paths/http_test.rb +5 -5
- data/test/paths/matcher_test.rb +11 -12
- data/test/paths/s3_test.rb +44 -46
- data/test/paths/sftp_test.rb +18 -18
- data/test/pgp_reader_test.rb +13 -15
- data/test/pgp_test.rb +43 -44
- data/test/pgp_writer_test.rb +27 -28
- data/test/record_reader_test.rb +9 -10
- data/test/record_writer_test.rb +10 -11
- data/test/row_reader_test.rb +5 -6
- data/test/row_writer_test.rb +7 -8
- data/test/stream_test.rb +60 -62
- data/test/tabular_test.rb +111 -111
- data/test/test_helper.rb +22 -22
- data/test/utils_test.rb +7 -7
- data/test/xlsx_reader_test.rb +12 -12
- data/test/zip_reader_test.rb +14 -21
- data/test/zip_writer_test.rb +10 -10
- metadata +4 -3
@@ -91,7 +91,7 @@ module IOStreams
|
|
91
91
|
case row
|
92
92
|
when Array
|
93
93
|
unless columns
|
94
|
-
raise(IOStreams::Errors::InvalidHeader,
|
94
|
+
raise(IOStreams::Errors::InvalidHeader, "Missing mandatory header when trying to convert a row into a hash")
|
95
95
|
end
|
96
96
|
|
97
97
|
array_to_hash(row)
|
@@ -142,9 +142,9 @@ module IOStreams
|
|
142
142
|
|
143
143
|
def cleanse_column(name)
|
144
144
|
cleansed = name.to_s.strip.downcase
|
145
|
-
cleansed.gsub!(/\s+/,
|
146
|
-
cleansed.gsub!(/-+/,
|
147
|
-
cleansed.gsub!(/\W+/,
|
145
|
+
cleansed.gsub!(/\s+/, "_")
|
146
|
+
cleansed.gsub!(/-+/, "_")
|
147
|
+
cleansed.gsub!(/\W+/, "")
|
148
148
|
cleansed
|
149
149
|
end
|
150
150
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "json"
|
2
2
|
module IOStreams
|
3
3
|
class Tabular
|
4
4
|
module Parser
|
@@ -15,9 +15,7 @@ module IOStreams
|
|
15
15
|
|
16
16
|
# Returns Array
|
17
17
|
def parse(row)
|
18
|
-
unless row.is_a?(::Array)
|
19
|
-
raise(IOStreams::Errors::TypeMismatch, "Format is :array. Invalid input: #{row.class.name}")
|
20
|
-
end
|
18
|
+
raise(IOStreams::Errors::TypeMismatch, "Format is :array. Invalid input: #{row.class.name}") unless row.is_a?(::Array)
|
21
19
|
|
22
20
|
row
|
23
21
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "csv"
|
2
2
|
module IOStreams
|
3
3
|
class Tabular
|
4
4
|
module Parser
|
@@ -25,9 +25,7 @@ module IOStreams
|
|
25
25
|
def parse(row)
|
26
26
|
return row if row.is_a?(::Array)
|
27
27
|
|
28
|
-
unless row.is_a?(String)
|
29
|
-
raise(IOStreams::Errors::TypeMismatch, "Format is :csv. Invalid input: #{row.class.name}")
|
30
|
-
end
|
28
|
+
raise(IOStreams::Errors::TypeMismatch, "Format is :csv. Invalid input: #{row.class.name}") unless row.is_a?(String)
|
31
29
|
|
32
30
|
parse_line(row)
|
33
31
|
end
|
@@ -50,7 +48,7 @@ module IOStreams
|
|
50
48
|
end
|
51
49
|
|
52
50
|
def render_array(array)
|
53
|
-
CSV.generate_line(array, encoding:
|
51
|
+
CSV.generate_line(array, encoding: "UTF-8", row_sep: "")
|
54
52
|
end
|
55
53
|
else
|
56
54
|
def parse_line(line)
|
@@ -23,7 +23,7 @@ module IOStreams
|
|
23
23
|
def render(row, header)
|
24
24
|
hash = header.to_hash(row)
|
25
25
|
|
26
|
-
result =
|
26
|
+
result = ""
|
27
27
|
fixed_layout.each do |map|
|
28
28
|
# A nil value is considered an empty string
|
29
29
|
value = hash[map.key].to_s
|
@@ -42,8 +42,8 @@ module IOStreams
|
|
42
42
|
hash = {}
|
43
43
|
index = 0
|
44
44
|
fixed_layout.each do |map|
|
45
|
-
value
|
46
|
-
index
|
45
|
+
value = line[index..(index + map.size - 1)]
|
46
|
+
index += map.size
|
47
47
|
hash[map.key] = value.to_s.strip
|
48
48
|
end
|
49
49
|
hash
|
@@ -60,6 +60,7 @@ module IOStreams
|
|
60
60
|
size = map[:size]
|
61
61
|
key = map[:key]
|
62
62
|
raise(ArgumentError, "Missing required :key and :size in: #{map.inspect}") unless size && key
|
63
|
+
|
63
64
|
FixedLayout.new(key, size)
|
64
65
|
end
|
65
66
|
end
|
@@ -1,12 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require "json"
|
2
2
|
module IOStreams
|
3
3
|
class Tabular
|
4
4
|
module Parser
|
5
5
|
class Hash < Base
|
6
6
|
def parse(row)
|
7
|
-
unless row.is_a?(::Hash)
|
8
|
-
raise(IOStreams::Errors::TypeMismatch, "Format is :hash. Invalid input: #{row.class.name}")
|
9
|
-
end
|
7
|
+
raise(IOStreams::Errors::TypeMismatch, "Format is :hash. Invalid input: #{row.class.name}") unless row.is_a?(::Hash)
|
10
8
|
|
11
9
|
row
|
12
10
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "json"
|
2
2
|
module IOStreams
|
3
3
|
class Tabular
|
4
4
|
module Parser
|
@@ -7,9 +7,7 @@ module IOStreams
|
|
7
7
|
def parse(row)
|
8
8
|
return row if row.is_a?(::Hash)
|
9
9
|
|
10
|
-
unless row.is_a?(String)
|
11
|
-
raise(IOStreams::Errors::TypeMismatch, "Format is :json. Invalid input: #{row.class.name}")
|
12
|
-
end
|
10
|
+
raise(IOStreams::Errors::TypeMismatch, "Format is :json. Invalid input: #{row.class.name}") unless row.is_a?(String)
|
13
11
|
|
14
12
|
JSON.parse(row)
|
15
13
|
end
|
@@ -12,27 +12,25 @@ module IOStreams
|
|
12
12
|
raise(IOStreams::Errors::InvalidHeader, "Format is :psv. Invalid input header: #{row.class.name}")
|
13
13
|
end
|
14
14
|
|
15
|
-
row.split(
|
15
|
+
row.split("|")
|
16
16
|
end
|
17
17
|
|
18
18
|
# Returns [Array] the parsed PSV line
|
19
19
|
def parse(row)
|
20
20
|
return row if row.is_a?(::Array)
|
21
21
|
|
22
|
-
unless row.is_a?(String)
|
23
|
-
raise(IOStreams::Errors::TypeMismatch, "Format is :psv. Invalid input: #{row.class.name}")
|
24
|
-
end
|
22
|
+
raise(IOStreams::Errors::TypeMismatch, "Format is :psv. Invalid input: #{row.class.name}") unless row.is_a?(String)
|
25
23
|
|
26
|
-
row.split(
|
24
|
+
row.split("|")
|
27
25
|
end
|
28
26
|
|
29
27
|
# Return the supplied array as a single line JSON string.
|
30
28
|
def render(row, header)
|
31
29
|
array = header.to_array(row)
|
32
30
|
cleansed_array = array.collect do |i|
|
33
|
-
i.is_a?(String) ? i.tr(
|
31
|
+
i.is_a?(String) ? i.tr("|", ":") : i
|
34
32
|
end
|
35
|
-
cleansed_array.join(
|
33
|
+
cleansed_array.join("|")
|
36
34
|
end
|
37
35
|
end
|
38
36
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "csv"
|
2
2
|
module IOStreams
|
3
3
|
class Tabular
|
4
4
|
module Utility
|
@@ -11,11 +11,11 @@ module IOStreams
|
|
11
11
|
# the file is broken apart based on line feeds during the upload process and
|
12
12
|
# is then processed by each worker on a line by line basis.
|
13
13
|
class CSVRow < ::CSV
|
14
|
-
UTF8_ENCODING = Encoding.find(
|
14
|
+
UTF8_ENCODING = Encoding.find("UTF-8").freeze
|
15
15
|
|
16
16
|
def initialize(encoding = UTF8_ENCODING)
|
17
|
-
@io = StringIO.new(
|
18
|
-
super(@io, row_sep:
|
17
|
+
@io = StringIO.new("".force_encoding(encoding))
|
18
|
+
super(@io, row_sep: "")
|
19
19
|
end
|
20
20
|
|
21
21
|
# Parse a single line of CSV data
|
@@ -39,9 +39,7 @@ module IOStreams
|
|
39
39
|
if part[-1] == @quote_char && part.count(@quote_char).odd?
|
40
40
|
# extended column ends
|
41
41
|
csv.last << part[0..-2]
|
42
|
-
if csv.last =~ @parsers[:stray_quote]
|
43
|
-
raise MalformedCSVError, "Missing or stray quote in line #{lineno + 1}"
|
44
|
-
end
|
42
|
+
raise MalformedCSVError, "Missing or stray quote in line #{lineno + 1}" if csv.last =~ @parsers[:stray_quote]
|
45
43
|
|
46
44
|
csv.last.gsub!(@quote_char * 2, @quote_char)
|
47
45
|
in_extended_col = false
|
@@ -59,9 +57,7 @@ module IOStreams
|
|
59
57
|
else
|
60
58
|
# regular quoted column
|
61
59
|
csv << part[1..-2]
|
62
|
-
if csv.last =~ @parsers[:stray_quote]
|
63
|
-
raise MalformedCSVError, "Missing or stray quote in line #{lineno + 1}"
|
64
|
-
end
|
60
|
+
raise MalformedCSVError, "Missing or stray quote in line #{lineno + 1}" if csv.last =~ @parsers[:stray_quote]
|
65
61
|
|
66
62
|
csv.last.gsub!(@quote_char * 2, @quote_char)
|
67
63
|
end
|
@@ -82,11 +78,9 @@ module IOStreams
|
|
82
78
|
# column.
|
83
79
|
csv[-1][-1] = @row_sep if in_extended_col
|
84
80
|
|
85
|
-
if in_extended_col
|
86
|
-
raise MalformedCSVError, "Unclosed quoted field on line #{lineno + 1}."
|
87
|
-
end
|
81
|
+
raise MalformedCSVError, "Unclosed quoted field on line #{lineno + 1}." if in_extended_col
|
88
82
|
|
89
|
-
@lineno
|
83
|
+
@lineno += 1
|
90
84
|
|
91
85
|
# save fields unconverted fields, if needed...
|
92
86
|
unconverted = csv.dup if @unconverted_fields
|
@@ -97,9 +91,7 @@ module IOStreams
|
|
97
91
|
csv = parse_headers(csv) if @use_headers
|
98
92
|
|
99
93
|
# inject unconverted fields and accessor, if requested...
|
100
|
-
if @unconverted_fields && (!csv.respond_to? :unconverted_fields)
|
101
|
-
add_unconverted_fields(csv, unconverted)
|
102
|
-
end
|
94
|
+
add_unconverted_fields(csv, unconverted) if @unconverted_fields && (!csv.respond_to? :unconverted_fields)
|
103
95
|
|
104
96
|
csv
|
105
97
|
end
|
data/lib/io_streams/utils.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "uri"
|
2
2
|
module IOStreams
|
3
3
|
module Utils
|
4
4
|
MAX_TEMP_FILE_NAME_ATTEMPTS = 5
|
@@ -24,7 +24,7 @@ module IOStreams
|
|
24
24
|
# Yields the path to a temporary file_name.
|
25
25
|
#
|
26
26
|
# File is deleted upon completion if present.
|
27
|
-
def self.temp_file_name(basename, extension =
|
27
|
+
def self.temp_file_name(basename, extension = "")
|
28
28
|
result = nil
|
29
29
|
::Dir::Tmpname.create([basename, extension], IOStreams.temp_dir, max_try: MAX_TEMP_FILE_NAME_ATTEMPTS) do |tmpname|
|
30
30
|
begin
|
@@ -40,7 +40,7 @@ module IOStreams
|
|
40
40
|
attr_reader :scheme, :hostname, :path, :user, :password, :port, :query
|
41
41
|
|
42
42
|
def initialize(url)
|
43
|
-
url = url.gsub(
|
43
|
+
url = url.gsub(" ", "%20")
|
44
44
|
uri = ::URI.parse(url)
|
45
45
|
@scheme = uri.scheme
|
46
46
|
@hostname = uri.hostname
|
@@ -0,0 +1,98 @@
|
|
1
|
+
require "net/http"
|
2
|
+
require "uri"
|
3
|
+
module IOStreams
|
4
|
+
module Utils
|
5
|
+
class ReliableHTTP
|
6
|
+
attr_reader :username, :password, :max_redirects, :url
|
7
|
+
|
8
|
+
# Reliable HTTP implementation with support for:
|
9
|
+
# * HTTP Redirects
|
10
|
+
# * Basic authentication
|
11
|
+
# * Raises an exception anytime the HTTP call is not successful.
|
12
|
+
# * TODO: Automatic retries with a logarithmic backoff strategy.
|
13
|
+
#
|
14
|
+
# Parameters:
|
15
|
+
# url: [String]
|
16
|
+
# URI of the file to download.
|
17
|
+
# Example:
|
18
|
+
# https://www5.fdic.gov/idasp/Offices2.zip
|
19
|
+
# http://hostname/path/file_name
|
20
|
+
#
|
21
|
+
# Full url showing all the optional elements that can be set via the url:
|
22
|
+
# https://username:password@hostname/path/file_name
|
23
|
+
#
|
24
|
+
# username: [String]
|
25
|
+
# When supplied, basic authentication is used with the username and password.
|
26
|
+
#
|
27
|
+
# password: [String]
|
28
|
+
# Password to use use with basic authentication when the username is supplied.
|
29
|
+
#
|
30
|
+
# max_redirects: [Integer]
|
31
|
+
# Maximum number of http redirects to follow.
|
32
|
+
def initialize(url, username: nil, password: nil, max_redirects: 10)
|
33
|
+
uri = URI.parse(url)
|
34
|
+
unless %w[http https].include?(uri.scheme)
|
35
|
+
raise(ArgumentError, "Invalid URL. Required Format: 'http://<host_name>/<file_name>', or 'https://<host_name>/<file_name>'")
|
36
|
+
end
|
37
|
+
|
38
|
+
@username = username || uri.user
|
39
|
+
@password = password || uri.password
|
40
|
+
@max_redirects = max_redirects
|
41
|
+
@url = url
|
42
|
+
end
|
43
|
+
|
44
|
+
# Read a file using an http get.
|
45
|
+
#
|
46
|
+
# For example:
|
47
|
+
# IOStreams.path('https://www5.fdic.gov/idasp/Offices2.zip').reader {|file| puts file.read}
|
48
|
+
#
|
49
|
+
# Read the file without unzipping and streaming the first file in the zip:
|
50
|
+
# IOStreams.path('https://www5.fdic.gov/idasp/Offices2.zip').stream(:none).reader {|file| puts file.read}
|
51
|
+
#
|
52
|
+
# Notes:
|
53
|
+
# * Since Net::HTTP download only supports a push stream, the data is streamed into a tempfile first.
|
54
|
+
def post(&block)
|
55
|
+
handle_redirects(Net::HTTP::Post, url, max_redirects, &block)
|
56
|
+
end
|
57
|
+
|
58
|
+
def get(&block)
|
59
|
+
handle_redirects(Net::HTTP::Get, url, max_redirects, &block)
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def handle_redirects(request_class, uri, max_redirects, &block)
|
65
|
+
uri = URI.parse(uri) unless uri.is_a?(URI)
|
66
|
+
result = nil
|
67
|
+
raise(IOStreams::Errors::CommunicationsFailure, "Too many redirects") if max_redirects < 1
|
68
|
+
|
69
|
+
Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
|
70
|
+
request = request_class.new(uri)
|
71
|
+
request.basic_auth(username, password) if username
|
72
|
+
|
73
|
+
http.request(request) do |response|
|
74
|
+
raise(IOStreams::Errors::CommunicationsFailure, "Invalid URL: #{uri}") if response.is_a?(Net::HTTPNotFound)
|
75
|
+
|
76
|
+
if response.is_a?(Net::HTTPUnauthorized)
|
77
|
+
raise(IOStreams::Errors::CommunicationsFailure, "Authorization Required: Invalid :username or :password.")
|
78
|
+
end
|
79
|
+
|
80
|
+
if response.is_a?(Net::HTTPRedirection)
|
81
|
+
new_uri = response["location"]
|
82
|
+
return handle_redirects(request_class, new_uri, max_redirects: max_redirects - 1, &block)
|
83
|
+
end
|
84
|
+
|
85
|
+
unless response.is_a?(Net::HTTPSuccess)
|
86
|
+
raise(IOStreams::Errors::CommunicationsFailure, "Invalid response code: #{response.code}")
|
87
|
+
end
|
88
|
+
|
89
|
+
yield(response) if block_given?
|
90
|
+
|
91
|
+
result = response
|
92
|
+
end
|
93
|
+
end
|
94
|
+
result
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
data/lib/io_streams/version.rb
CHANGED
data/lib/io_streams/writer.rb
CHANGED
@@ -5,7 +5,7 @@ module IOStreams
|
|
5
5
|
def self.stream(output_stream, original_file_name: nil, **args, &block)
|
6
6
|
Utils.temp_file_name("iostreams_writer") do |file_name|
|
7
7
|
file(file_name, original_file_name: original_file_name, **args, &block)
|
8
|
-
::File.open(file_name,
|
8
|
+
::File.open(file_name, "rb") { |source| ::IO.copy_stream(source, output_stream) }
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "csv"
|
2
2
|
|
3
3
|
module IOStreams
|
4
4
|
module Xlsx
|
@@ -6,15 +6,15 @@ module IOStreams
|
|
6
6
|
# Convert a xlsx, or xlsm file into CSV format.
|
7
7
|
def self.file(file_name, original_file_name: file_name, &block)
|
8
8
|
# Stream into a temp file as csv
|
9
|
-
Utils.temp_file_name(
|
10
|
-
::File.open(temp_file_name,
|
11
|
-
::File.open(temp_file_name,
|
9
|
+
Utils.temp_file_name("iostreams_csv") do |temp_file_name|
|
10
|
+
::File.open(temp_file_name, "wb") { |io| new(file_name).each { |lines| io << lines.to_csv } }
|
11
|
+
::File.open(temp_file_name, "rb", &block)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
def initialize(file_name)
|
16
16
|
begin
|
17
|
-
require
|
17
|
+
require "creek" unless defined?(Creek::Book)
|
18
18
|
rescue LoadError => e
|
19
19
|
raise(LoadError, "Please install the 'creek' gem for xlsx streaming support. #{e.message}")
|
20
20
|
end
|
@@ -48,7 +48,7 @@ module IOStreams
|
|
48
48
|
# The input stream from the first file found in the zip file is passed
|
49
49
|
# to the supplied block
|
50
50
|
def self.file(file_name, entry_file_name: nil, &block)
|
51
|
-
Utils.load_soft_dependency(
|
51
|
+
Utils.load_soft_dependency("rubyzip v1.x", "Read Zip", "zip") unless defined?(::Zip)
|
52
52
|
|
53
53
|
::Zip::File.open(file_name) do |zip_file|
|
54
54
|
if entry_file_name
|
@@ -19,9 +19,9 @@ module IOStreams
|
|
19
19
|
if entry_file_name.nil? && original_file_name && (original_file_name =~ /\.(zip)\z/i)
|
20
20
|
entry_file_name = original_file_name.to_s[0..-5]
|
21
21
|
end
|
22
|
-
entry_file_name ||=
|
22
|
+
entry_file_name ||= "file"
|
23
23
|
|
24
|
-
Utils.load_soft_dependency(
|
24
|
+
Utils.load_soft_dependency("zip_tricks", "Zip") unless defined?(ZipTricks::Streamer)
|
25
25
|
|
26
26
|
ZipTricks::Streamer.open(output_stream) { |zip| zip.write_deflated_file(entry_file_name, &block) }
|
27
27
|
end
|
data/lib/iostreams.rb
CHANGED
@@ -1,59 +1,59 @@
|
|
1
|
-
require
|
1
|
+
require "io_streams/version"
|
2
2
|
# @formatter:off
|
3
3
|
module IOStreams
|
4
|
-
autoload :Builder,
|
5
|
-
autoload :Errors,
|
6
|
-
autoload :Path,
|
7
|
-
autoload :Pgp,
|
8
|
-
autoload :Reader,
|
9
|
-
autoload :Stream,
|
10
|
-
autoload :Tabular,
|
11
|
-
autoload :Utils,
|
12
|
-
autoload :Writer,
|
4
|
+
autoload :Builder, "io_streams/builder"
|
5
|
+
autoload :Errors, "io_streams/errors"
|
6
|
+
autoload :Path, "io_streams/path"
|
7
|
+
autoload :Pgp, "io_streams/pgp"
|
8
|
+
autoload :Reader, "io_streams/reader"
|
9
|
+
autoload :Stream, "io_streams/stream"
|
10
|
+
autoload :Tabular, "io_streams/tabular"
|
11
|
+
autoload :Utils, "io_streams/utils"
|
12
|
+
autoload :Writer, "io_streams/writer"
|
13
13
|
|
14
14
|
module Paths
|
15
|
-
autoload :File,
|
16
|
-
autoload :HTTP,
|
17
|
-
autoload :Matcher,
|
18
|
-
autoload :S3,
|
19
|
-
autoload :SFTP,
|
15
|
+
autoload :File, "io_streams/paths/file"
|
16
|
+
autoload :HTTP, "io_streams/paths/http"
|
17
|
+
autoload :Matcher, "io_streams/paths/matcher"
|
18
|
+
autoload :S3, "io_streams/paths/s3"
|
19
|
+
autoload :SFTP, "io_streams/paths/sftp"
|
20
20
|
end
|
21
21
|
|
22
22
|
module Bzip2
|
23
|
-
autoload :Reader,
|
24
|
-
autoload :Writer,
|
23
|
+
autoload :Reader, "io_streams/bzip2/reader"
|
24
|
+
autoload :Writer, "io_streams/bzip2/writer"
|
25
25
|
end
|
26
26
|
module Encode
|
27
|
-
autoload :Reader,
|
28
|
-
autoload :Writer,
|
27
|
+
autoload :Reader, "io_streams/encode/reader"
|
28
|
+
autoload :Writer, "io_streams/encode/writer"
|
29
29
|
end
|
30
30
|
module Gzip
|
31
|
-
autoload :Reader,
|
32
|
-
autoload :Writer,
|
31
|
+
autoload :Reader, "io_streams/gzip/reader"
|
32
|
+
autoload :Writer, "io_streams/gzip/writer"
|
33
33
|
end
|
34
34
|
module Line
|
35
|
-
autoload :Reader,
|
36
|
-
autoload :Writer,
|
35
|
+
autoload :Reader, "io_streams/line/reader"
|
36
|
+
autoload :Writer, "io_streams/line/writer"
|
37
37
|
end
|
38
38
|
module Record
|
39
|
-
autoload :Reader,
|
40
|
-
autoload :Writer,
|
39
|
+
autoload :Reader, "io_streams/record/reader"
|
40
|
+
autoload :Writer, "io_streams/record/writer"
|
41
41
|
end
|
42
42
|
module Row
|
43
|
-
autoload :Reader,
|
44
|
-
autoload :Writer,
|
43
|
+
autoload :Reader, "io_streams/row/reader"
|
44
|
+
autoload :Writer, "io_streams/row/writer"
|
45
45
|
end
|
46
46
|
module SymmetricEncryption
|
47
|
-
autoload :Reader,
|
48
|
-
autoload :Writer,
|
47
|
+
autoload :Reader, "io_streams/symmetric_encryption/reader"
|
48
|
+
autoload :Writer, "io_streams/symmetric_encryption/writer"
|
49
49
|
end
|
50
50
|
module Xlsx
|
51
|
-
autoload :Reader,
|
51
|
+
autoload :Reader, "io_streams/xlsx/reader"
|
52
52
|
end
|
53
53
|
module Zip
|
54
|
-
autoload :Reader,
|
55
|
-
autoload :Writer,
|
54
|
+
autoload :Reader, "io_streams/zip/reader"
|
55
|
+
autoload :Writer, "io_streams/zip/writer"
|
56
56
|
end
|
57
57
|
end
|
58
|
-
require
|
59
|
-
require
|
58
|
+
require "io_streams/deprecated"
|
59
|
+
require "io_streams/io_streams"
|