hash_wia 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.version +1 -1
- data/lib/hash_wia/class.rb +0 -1
- data/lib/hash_wia/module.rb +5 -3
- data/lib/hash_wia/pollute.rb +9 -6
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb0fdfd83e1409f99637fafa8d673cc64fd61865dfa798306f0422f748cd661b
|
4
|
+
data.tar.gz: 1c9947999bc89ffd071ce50d8bc3822d7540d438c6570bf33b45c86b58f10cc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d28eada7847195d2ce9cdf0d40030af6b3396d2b71ae99e2f7d0587923768a2a72f3e0b3a4c1f35177e37b5ecff45c43a056f981d919b42568505932c27442a4
|
7
|
+
data.tar.gz: 061c43be03c32af497fc10ee587ef70840fde3e7c367c443211259d54fd791b37ca65a9ca065491b8508e7c3bad8649ce9e112c855e1e46804fb0e4755ffaff6
|
data/.version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.3
|
data/lib/hash_wia/class.rb
CHANGED
data/lib/hash_wia/module.rb
CHANGED
@@ -37,7 +37,7 @@ module HashWiaModule
|
|
37
37
|
# key is common id direct access
|
38
38
|
# allow direct get or fuction the same if name given
|
39
39
|
def key name=nil
|
40
|
-
name ? self[
|
40
|
+
name.nil? ? self[:key] : self[name.to_s]
|
41
41
|
end
|
42
42
|
|
43
43
|
# true clone of the hash with 0 references to the old one
|
@@ -67,9 +67,11 @@ module HashWiaModule
|
|
67
67
|
if block
|
68
68
|
# h.foo { rand }
|
69
69
|
self[name] = block
|
70
|
-
|
70
|
+
elsif !keys.include?(name.to_sym)
|
71
71
|
# h.foo
|
72
|
-
raise
|
72
|
+
raise NoMethodError.new('%s not defined' % strname)
|
73
|
+
else
|
74
|
+
nil
|
73
75
|
end
|
74
76
|
else
|
75
77
|
value
|
data/lib/hash_wia/pollute.rb
CHANGED
@@ -5,13 +5,16 @@ class Hash
|
|
5
5
|
unless args.first
|
6
6
|
HashWia.new self
|
7
7
|
else
|
8
|
-
list
|
9
|
-
|
10
|
-
HashWia::STRUCTS[name] ||= ::Struct.new(name, *list)
|
8
|
+
list = args.flatten
|
9
|
+
extra = keys - list
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
if extra.first
|
12
|
+
raise ArgumentError.new('Unallowed key/s: %s' % extra.map{ |_| ':%s' % _ }.join(', '))
|
13
|
+
end
|
14
|
+
|
15
|
+
HashWia.new.tap do |o|
|
16
|
+
list.each do |k|
|
17
|
+
o[k] = self[k]
|
15
18
|
end
|
16
19
|
end
|
17
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hash_wia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dino Reic
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Gem provides simple access to common Ruby hash types bundled in one simple
|
14
14
|
class
|
@@ -26,7 +26,7 @@ homepage: https://github.com/dux/hash_wia
|
|
26
26
|
licenses:
|
27
27
|
- MIT
|
28
28
|
metadata: {}
|
29
|
-
post_install_message:
|
29
|
+
post_install_message:
|
30
30
|
rdoc_options: []
|
31
31
|
require_paths:
|
32
32
|
- lib
|
@@ -42,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
42
|
version: '0'
|
43
43
|
requirements: []
|
44
44
|
rubygems_version: 3.0.6
|
45
|
-
signing_key:
|
45
|
+
signing_key:
|
46
46
|
specification_version: 4
|
47
47
|
summary: Hash with indifferent access + goodies
|
48
48
|
test_files: []
|