eitil 1.1.32 → 1.1.36
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/eitil_core/README.md +29 -0
- data/eitil_core/lib/eitil_core/array/map_strings.rb +33 -0
- data/eitil_core/lib/eitil_core/array.rb +2 -1
- data/eitil_core/lib/eitil_core/hash/transform_string_values.rb +33 -0
- data/eitil_core/lib/eitil_core/hash.rb +1 -0
- data/eitil_core/lib/eitil_core/type_checkers/is_num_or_nan.rb +53 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/drop_data.rb +7 -1
- data/eitil_integrate/lib/eitil_integrate/application_exporter/lookups.rb +10 -1
- data/eitil_store/lib/eitil_store/regex/regex.rb +1 -1
- data/lib/eitil/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a727b342fdcf5d8606bce86c115045c5a90621fe3624e59b92c16b2ecdfb8a4b
|
|
4
|
+
data.tar.gz: afe1a161ccaf4d9b6d91d8052c8e76cf787b85e3f156d9ff1ffe696556ec064f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6a30323d8425614fd455de01f08a7eef79ba43d215fb039335302288d1f6ad81bc74f192857306cbc6c9ca7bc4cf7e1d86f1e35a6be9c69e4c72112d550fbc10
|
|
7
|
+
data.tar.gz: 6ddf4cfdc22dad7cc028129306b926945da729f0ed7c0234a32498b2c68a23c9c8bdbff3d4307e08da23bb0929fde358a32352b55afdc73d58d6cb13844cca69
|
data/eitil_core/README.md
CHANGED
|
@@ -181,6 +181,21 @@ require "eitil_core/array"
|
|
|
181
181
|
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
+
```ruby
|
|
185
|
+
# require "eitil_core/array/map_strings"
|
|
186
|
+
|
|
187
|
+
map_strings(&block)
|
|
188
|
+
# transforms all strings in infinite recursion by yielding the given block, also works for strings contained in hashes.
|
|
189
|
+
# call as: ["hey", ["hi", {a: "ho"}]].map_strings! { |str| str.upcase }
|
|
190
|
+
# => ["HEY", ["HI", {a: "HO"}]]
|
|
191
|
+
```
|
|
192
|
+
```ruby
|
|
193
|
+
# require "eitil_core/array/map_strings"
|
|
194
|
+
|
|
195
|
+
map_strings!(&block)
|
|
196
|
+
# bang variant of .map_strings, which recursively modifies all objects it is called on.
|
|
197
|
+
```
|
|
198
|
+
|
|
184
199
|
```ruby
|
|
185
200
|
# require "eitil_core/array/slice_hashes"
|
|
186
201
|
|
|
@@ -355,6 +370,20 @@ auto_dig(_hash = self, _key)
|
|
|
355
370
|
# => 3
|
|
356
371
|
```
|
|
357
372
|
|
|
373
|
+
```ruby
|
|
374
|
+
# require "eitil_core/hash/transform_string_values"
|
|
375
|
+
|
|
376
|
+
transform_string_values(&block)
|
|
377
|
+
# transforms all strings in infinite recursion by yielding the given block, also works for strings contained in arrays.
|
|
378
|
+
# call as: {a: "hey", b: {c: "hi", d: ["ho"]}}.transform_string_values! { |str| str.upcase }
|
|
379
|
+
# => {a: "HEY", b: {c: "HI", d: ["HO"]}}
|
|
380
|
+
```
|
|
381
|
+
```ruby
|
|
382
|
+
# require "eitil_core/hash/transform_string_values"
|
|
383
|
+
|
|
384
|
+
transform_string_values!(&block)
|
|
385
|
+
# bang variant of .transform_string_values, which recursively modifies all objects it is called on.
|
|
386
|
+
```
|
|
358
387
|
|
|
359
388
|
## Lookups
|
|
360
389
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
# require "eitil_core/array/map_strings"
|
|
3
|
+
|
|
4
|
+
require "eitil_core/hash/transform_string_values"
|
|
5
|
+
|
|
6
|
+
class Array
|
|
7
|
+
|
|
8
|
+
def map_strings!(&block)
|
|
9
|
+
map! do |item|
|
|
10
|
+
|
|
11
|
+
if item.class == String
|
|
12
|
+
yield item
|
|
13
|
+
|
|
14
|
+
elsif item.class == Hash
|
|
15
|
+
item.transform_string_values!(&block)
|
|
16
|
+
|
|
17
|
+
elsif item.class == Array
|
|
18
|
+
item.map_strings!(&block)
|
|
19
|
+
|
|
20
|
+
else
|
|
21
|
+
item
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
self
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def map_strings(&block)
|
|
30
|
+
deep_dup.map_strings!(&block)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
# require "eitil_core/hash/transform_string_values"
|
|
3
|
+
|
|
4
|
+
require "eitil_core/array/map_strings"
|
|
5
|
+
|
|
6
|
+
class Hash
|
|
7
|
+
|
|
8
|
+
def transform_string_values!(&block)
|
|
9
|
+
transform_values! do |value|
|
|
10
|
+
|
|
11
|
+
if value.class == String
|
|
12
|
+
yield value
|
|
13
|
+
|
|
14
|
+
elsif value.class == Hash
|
|
15
|
+
value.transform_string_values!(&block)
|
|
16
|
+
|
|
17
|
+
elsif value.class == Array
|
|
18
|
+
value.map_strings!(&block)
|
|
19
|
+
|
|
20
|
+
else
|
|
21
|
+
value
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
self
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def transform_string_values(&block)
|
|
30
|
+
deep_dup.transform_string_values!(&block)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
@@ -94,3 +94,56 @@ class Array
|
|
|
94
94
|
end
|
|
95
95
|
|
|
96
96
|
end
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class Date
|
|
100
|
+
|
|
101
|
+
def is_nan?
|
|
102
|
+
true
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def is_num?
|
|
106
|
+
false
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
class DateTime
|
|
113
|
+
|
|
114
|
+
def is_nan?
|
|
115
|
+
true
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def is_num?
|
|
119
|
+
false
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class Time
|
|
126
|
+
|
|
127
|
+
def is_nan?
|
|
128
|
+
true
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def is_num?
|
|
132
|
+
false
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
class ActiveSupport::TimeWithZone
|
|
139
|
+
|
|
140
|
+
def is_nan?
|
|
141
|
+
true
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def is_num?
|
|
145
|
+
false
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
end
|
|
149
|
+
|
|
@@ -17,7 +17,7 @@ module EitilIntegrate::RubyXL
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def try_float_conversion
|
|
20
|
-
@hash.transform_values! { |array| array.map { |item| item.is_num? ? item
|
|
20
|
+
@hash.transform_values! { |array| array.map { |item| item.is_num? ? to_float(item) : item } }
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def drop_nil_values
|
|
@@ -37,6 +37,12 @@ module EitilIntegrate::RubyXL
|
|
|
37
37
|
value_is_a_int || value_is_a_float || value_is_a_time_string
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
def to_float(object)
|
|
41
|
+
# Implemented a new to_float method, which replaces .to_f, because "7.5".to_f
|
|
42
|
+
# would correctly return 7.5, but "7,5" would incorrectly return 7.0.
|
|
43
|
+
object.is_a?(String) ? object.gsub(',','.').to_f : object.to_f
|
|
44
|
+
end
|
|
45
|
+
|
|
40
46
|
def value_is_a_int
|
|
41
47
|
@value.is_a? Integer
|
|
42
48
|
end
|
|
@@ -33,7 +33,16 @@ module EitilIntegrate::RubyXL
|
|
|
33
33
|
# names are often sufficient
|
|
34
34
|
def exporter_taxonomy
|
|
35
35
|
exporter_infos.transform_values do |settings|
|
|
36
|
-
|
|
36
|
+
|
|
37
|
+
settings.transform_values do |info|
|
|
38
|
+
|
|
39
|
+
if info.is_a? Array
|
|
40
|
+
info.first.is_a?(Hash) ? info.first.keys : info
|
|
41
|
+
else
|
|
42
|
+
info
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
end
|
|
37
46
|
end
|
|
38
47
|
end
|
|
39
48
|
|
|
@@ -16,7 +16,7 @@ module EitilStore
|
|
|
16
16
|
UUID = /\A(\h{32}|\h{8}-\h{4}-\h{4}-\h{4}-\h{12})\z/
|
|
17
17
|
|
|
18
18
|
# IsNum comes from the Rubinius source code and identifies both integers and floats correctly.
|
|
19
|
-
IsNum = /^\s*[+-]?((\d+_?)*\d+(
|
|
19
|
+
IsNum = /^\s*[+-]?((\d+_?)*\d+([.,](\d+_?)*\d+)?|\.(\d+_?)*\d+)(\s*|([eE][+-]?(\d+_?)*\d+)\s*)$/
|
|
20
20
|
|
|
21
21
|
# Validates Credit Card numbers, Checks if it contains 16 numbers in groups of 4 separated by -, space or nothing
|
|
22
22
|
CreditCard = /\A(\d{4}-){3}\d{4}\z|\A(\d{4}\s){3}\d{4}\z|\A\d{16}\z/
|
data/lib/eitil/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: eitil
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.36
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jurriaan Schrofer
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-09-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -103,6 +103,7 @@ files:
|
|
|
103
103
|
- eitil_core/lib/eitil_core/argument_helpers/args_to_ivars.rb
|
|
104
104
|
- eitil_core/lib/eitil_core/argument_helpers/args_to_ivars_bang.rb
|
|
105
105
|
- eitil_core/lib/eitil_core/array.rb
|
|
106
|
+
- eitil_core/lib/eitil_core/array/map_strings.rb
|
|
106
107
|
- eitil_core/lib/eitil_core/array/slice_hashes.rb
|
|
107
108
|
- eitil_core/lib/eitil_core/concerns.rb
|
|
108
109
|
- eitil_core/lib/eitil_core/concerns/include_concerns_of.rb
|
|
@@ -119,6 +120,7 @@ files:
|
|
|
119
120
|
- eitil_core/lib/eitil_core/formatters/sql.rb
|
|
120
121
|
- eitil_core/lib/eitil_core/hash.rb
|
|
121
122
|
- eitil_core/lib/eitil_core/hash/auto_dig.rb
|
|
123
|
+
- eitil_core/lib/eitil_core/hash/transform_string_values.rb
|
|
122
124
|
- eitil_core/lib/eitil_core/lookups.rb
|
|
123
125
|
- eitil_core/lib/eitil_core/lookups/all_methods.rb
|
|
124
126
|
- eitil_core/lib/eitil_core/lookups/gem_path.rb
|