nice_hash 1.18.6 → 1.18.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -0
  3. data/lib/nice_hash.rb +2 -8
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31eff5dcaddcefea5b8a0f4d8ba07abe0d2cfaab20faaad062f959a1deaf2534
4
- data.tar.gz: '06121691bf7510bbd52705a7a46ce7a1fd9796a7cbfac15094099453926fa4f9'
3
+ metadata.gz: 1c8cb3e741e17cf400b34bc3a31ec874fb030466b2f56431f0ec5aa79e37af7f
4
+ data.tar.gz: f023c96b5a5768bac968765032c782d1d01e9705f778748903fb75a0b91d582e
5
5
  SHA512:
6
- metadata.gz: 2a87e32e7b1f0a0d7bc89add846c9d57b85678d0857433a64194242a6eb5db8667948b53b7aad133bd5090f7a337da331e26f7cf4264a9c0aa41be7ea1a5ab9f
7
- data.tar.gz: b29dfe60081b383e5408f7f2022d077e55254226b8e619fb758e8fa82b761c960e08831c46e4fcafea38ae905d7929d2b697d82ce597e33f674c820040eda781
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 ||= true
2
- if defined?(RSpec)
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.6
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-15 00:00:00.000000000 Z
11
+ date: 2024-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: string_pattern