serega 0.33.1 → 0.33.2
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/VERSION +1 -1
- data/lib/serega/utils/method_signature.rb +2 -12
- data/lib/serega/utils/to_hash.rb +4 -3
- 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: a5ecb4ac9c23db4ed45c7118bcd62b8a07f20710bac2ea8fd57aea0f66e136af
|
|
4
|
+
data.tar.gz: b5af4351059c516658d6031f68fbf5dfa0e9e5a5e03e9c70d904848e7a5a8a4d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 33267e2460b8b48da8b2b0886ac1fa2dc4c47fad82f594e277195c092d3100891b98901824c802bf5d23b3ee045ef00e6c9c904ab059faa52f403cb91ccc88fc
|
|
7
|
+
data.tar.gz: d89903f46ee168ab027bad60e253170c50c67fc029e4357db5947aef48066c94edc581fb156323f9f6eb5a822ad21da5909fb5591f473fda936fc22c5bb74b91
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.33.
|
|
1
|
+
0.33.2
|
|
@@ -42,12 +42,7 @@ class Serega
|
|
|
42
42
|
|
|
43
43
|
params.each do |type, name|
|
|
44
44
|
case type
|
|
45
|
-
when :req
|
|
46
|
-
positional_parameters += 1
|
|
47
|
-
pos_limit -= 1
|
|
48
|
-
when :opt
|
|
49
|
-
next if pos_limit <= 0
|
|
50
|
-
|
|
45
|
+
when :req, :opt
|
|
51
46
|
positional_parameters += 1
|
|
52
47
|
pos_limit -= 1
|
|
53
48
|
when :rest
|
|
@@ -55,12 +50,7 @@ class Serega
|
|
|
55
50
|
|
|
56
51
|
positional_parameters += pos_limit
|
|
57
52
|
pos_limit = 0
|
|
58
|
-
when :keyreq
|
|
59
|
-
keyword_parameters << name
|
|
60
|
-
keyword_args.delete(name)
|
|
61
|
-
when :key
|
|
62
|
-
next unless keyword_args.include?(name)
|
|
63
|
-
|
|
53
|
+
when :key, :keyreq
|
|
64
54
|
keyword_parameters << name
|
|
65
55
|
keyword_args.delete(name)
|
|
66
56
|
when :keyrest
|
data/lib/serega/utils/to_hash.rb
CHANGED
|
@@ -10,15 +10,16 @@ class Serega
|
|
|
10
10
|
#
|
|
11
11
|
# Constructs deep hashes from provided data
|
|
12
12
|
#
|
|
13
|
-
# @param value [Array, Hash, String, Symbol, NilClass, FalseClass] Value to transform
|
|
13
|
+
# @param value [Array, Hash, String, Symbol, NilClass, FalseClass, TrueClass] Value to transform
|
|
14
14
|
#
|
|
15
15
|
# @example
|
|
16
16
|
# Serega::SeregaUtils::ToHash.(nil) # => {}
|
|
17
|
+
# Serega::SeregaUtils::ToHash.(true) # => {}
|
|
17
18
|
# Serega::SeregaUtils::ToHash.(false) # => {}
|
|
18
19
|
# Serega::SeregaUtils::ToHash.(:foo) # => {:foo=>{}}
|
|
19
20
|
# Serega::SeregaUtils::ToHash.("foo") # => {:foo=>{}}
|
|
20
21
|
# Serega::SeregaUtils::ToHash.(%w[foo bar]) # => {:foo=>{}, :bar=>{}}
|
|
21
|
-
# Serega::SeregaUtils::ToHash.({ foo: nil, bar:
|
|
22
|
+
# Serega::SeregaUtils::ToHash.({ foo: nil, bar: true }) # => {:foo=>{}, :bar=>{}}
|
|
22
23
|
# Serega::SeregaUtils::ToHash.({ foo: :bar }) # => {:foo=>{:bar=>{}}}
|
|
23
24
|
# Serega::SeregaUtils::ToHash.({ foo: [:bar] }) # => {:foo=>{:bar=>{}}}
|
|
24
25
|
#
|
|
@@ -28,7 +29,7 @@ class Serega
|
|
|
28
29
|
case value
|
|
29
30
|
when Array then array_to_hash(value)
|
|
30
31
|
when Hash then hash_to_hash(value)
|
|
31
|
-
when NilClass, FalseClass then nil_to_hash(value)
|
|
32
|
+
when NilClass, FalseClass, TrueClass then nil_to_hash(value)
|
|
32
33
|
when String then string_to_hash(value)
|
|
33
34
|
when Symbol then symbol_to_hash(value)
|
|
34
35
|
else raise SeregaError, "Can't convert #{value.class} class object to hash"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: serega
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.33.
|
|
4
|
+
version: 0.33.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrey Glushkov
|
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
121
121
|
- !ruby/object:Gem::Version
|
|
122
122
|
version: '0'
|
|
123
123
|
requirements: []
|
|
124
|
-
rubygems_version: 3.7
|
|
124
|
+
rubygems_version: 3.6.7
|
|
125
125
|
specification_version: 4
|
|
126
126
|
summary: JSON Serializer
|
|
127
127
|
test_files: []
|