easy_sheet_io 0.3.2 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4f7a9dd49dc973c3a928ff03daf2100caf8b5ebd230bd944097139620e8b9bc
4
- data.tar.gz: 223e50284094338aa8ea2600c8fdeb1de51e1206322aa8e3d1dbeb2d6518b255
3
+ metadata.gz: 0eb1e608ff7813cad651c93966644a89c2562595ffb3a5da4af5f76969face49
4
+ data.tar.gz: 65ca712fd6b04385518aa2af73a5874664a666da30900edc650f006ca765f147
5
5
  SHA512:
6
- metadata.gz: c444ddd73593576667f929823e5ec5d51c789139eaaabf042b120d2dc9aa32d2c325f815a72912af807650a9202204ee93f46ee8b21e222862bdb11bac683344
7
- data.tar.gz: 3a2011d6d9232a43fd67be57fe59799d792d07651d6381880c7ea602be8407c17772df140548ed28862ec4ed23f9d922c98508347c32524dbdcede18542aa95e
6
+ metadata.gz: 4df72848af130d1d1c0c16eb0bc3324d0bb28cc706fb6cfbe295fe4ba4d6c106e3c82585a4b19836e42daa38a27ae161714034305ab36d8a358f48fc856da2f9
7
+ data.tar.gz: 7b9b9c0f6b20a872f18b1b87844ce25a813ce16d3eadd877df9186471915dc1e82c472fee3d67cf9976bfb5805624525650ac50d4cfe0775bc27939f09c87edb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- easy_sheet_io (0.3.0)
4
+ easy_sheet_io (0.3.3)
5
5
  daru (>= 0.3)
6
6
  rake (~> 13.0)
7
7
  roo-xls (>= 1.2.0)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EasySheetIo
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.5"
5
5
  end
data/lib/easy_sheet_io.rb CHANGED
@@ -23,7 +23,7 @@ module EasySheetIo
23
23
  # Get 2D Array
24
24
  begin
25
25
  csv = CSV.parse(File.open(path, encoding: encoding, &:read), col_sep: col_sep)
26
- rescue Encoding::InvalidByteSequenceError
26
+ rescue
27
27
  # Try Another Encoding
28
28
  puts "Fail Encoding #{encoding}. Trying cp932..."
29
29
  csv = CSV.parse(File.open(path, encoding: "cp932", &:read), col_sep: col_sep)
@@ -51,7 +51,7 @@ module EasySheetIo
51
51
  ## Option line_ignored is not implemented yet.
52
52
  def to_hash(array2d, line_from: 1, line_until: nil, line_ignored: nil,
53
53
  header: 0, symbol_header: false,
54
- replace_to_nil: [], analyze_type: false)
54
+ replaced_by_nil: [], analyze_type: true)
55
55
 
56
56
  # Define Read Range------------
57
57
  lfrom, luntil = line_from, line_until
@@ -67,7 +67,7 @@ module EasySheetIo
67
67
  # Define Data Array------------
68
68
  output = array2d[lfrom...luntil]
69
69
  output_transpose = output[0].zip(*output[1..])
70
- output_transpose = fix_array(output_transpose, replace_to_nil, analyze_type)
70
+ output_transpose = fix_array(output_transpose, replaced_by_nil, analyze_type)
71
71
  # -----------------------------
72
72
 
73
73
  # Define Header----------------
@@ -126,12 +126,12 @@ module EasySheetIo
126
126
  end
127
127
 
128
128
  # Fix Array (Replace specific values to nil, recognize value type and cast values to the type.)
129
- def fix_array(array2d, replace_to_nil, analyze_type)
129
+ def fix_array(array2d, replaced_by_nil, analyze_type)
130
130
  ans = array2d
131
131
 
132
132
  ## Replace Blank or User-Selected Value
133
133
  ans = ans.map do |column|
134
- column.map { |cell| replace_to_nil.include?(cell) || /^\s*$/ === cell ? nil : cell }
134
+ column.map { |cell| replaced_by_nil.include?(cell) || /^\s*$/ === cell ? nil : cell }
135
135
  end
136
136
 
137
137
  ## Replace Number Values to Integer or Float
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_sheet_io
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - show-o-atakun
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-25 00:00:00.000000000 Z
11
+ date: 2022-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake