nice_hash 1.18.6 → 1.18.7
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 +9 -0
- data/lib/nice_hash.rb +2 -8
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1c8cb3e741e17cf400b34bc3a31ec874fb030466b2f56431f0ec5aa79e37af7f
|
|
4
|
+
data.tar.gz: f023c96b5a5768bac968765032c782d1d01e9705f778748903fb75a0b91d582e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 448740fdbc4843c705ac79d5d33ba6fcfdf453e7ff76d1a0cf77fa2a648c37ca99d441fcef8378030e2de77a100d907832e216938948c9f3b8ebba3e8ef75b8a
|
|
7
|
+
data.tar.gz: 6d3acf6139d0612d7d3ae45b5fec8ca19ba66262f9b4f6b71c26e66c4ca1df68f60a7d6f120307e267d06752d3db3fec43265e82004bf1ef9143ec4ea89531ed
|
data/README.md
CHANGED
|
@@ -171,6 +171,15 @@ Also if you have a JSON string you want to parse it and get the values of certai
|
|
|
171
171
|
#> {:name=>["Peter Smith", ["myFavor1", "Special ticket"]], :idt=>[345, 3123, 3145]}
|
|
172
172
|
```
|
|
173
173
|
|
|
174
|
+
To make easier to compare values by default it is setup SP_COMPARE_NUMBERS_AS_STRINGS = true, that will return true for example in these comparations:
|
|
175
|
+
* '300' == 300
|
|
176
|
+
* '300.12' == 300.12
|
|
177
|
+
* "" == nil
|
|
178
|
+
|
|
179
|
+
To avoid that set SP_COMPARE_NUMBERS_AS_STRINGS = false before `require 'nice_hash'`
|
|
180
|
+
Take in consideration certain libraries (fex 'net/ldap') are failing if `SP_COMPARE_NUMBERS_AS_STRINGS` is set to true. Since NiceHash is modifying the String class.
|
|
181
|
+
|
|
182
|
+
|
|
174
183
|
### How to access the different keys
|
|
175
184
|
|
|
176
185
|
You can access the keys of the hash like always, but now we added to the Hash class the posibility of accessing it using:
|
data/lib/nice_hash.rb
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
SP_ADD_TO_RUBY
|
|
2
|
-
if defined?(
|
|
3
|
-
SP_COMPARE_NUMBERS_AS_STRINGS ||= true
|
|
4
|
-
else
|
|
5
|
-
SP_COMPARE_NUMBERS_AS_STRINGS ||= false
|
|
6
|
-
end
|
|
7
|
-
#todo: consider adding SP_USE_NESTED_KEYS = true
|
|
1
|
+
SP_ADD_TO_RUBY = true if !defined?(SP_ADD_TO_RUBY)
|
|
2
|
+
SP_COMPARE_NUMBERS_AS_STRINGS = true if !defined?(SP_COMPARE_NUMBERS_AS_STRINGS)
|
|
8
3
|
|
|
9
4
|
require_relative "nice/hash/add_to_ruby" if SP_ADD_TO_RUBY
|
|
10
5
|
require_relative "nice/hash/change_one_by_one"
|
|
@@ -23,7 +18,6 @@ require_relative "nice/hash/transtring"
|
|
|
23
18
|
require_relative "nice/hash/validate"
|
|
24
19
|
require_relative "nice/hash/deep_clone"
|
|
25
20
|
|
|
26
|
-
|
|
27
21
|
require "string_pattern"
|
|
28
22
|
|
|
29
23
|
###########################################################################
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nice_hash
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.18.
|
|
4
|
+
version: 1.18.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mario Ruiz
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-03-
|
|
11
|
+
date: 2024-03-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: string_pattern
|