activeyaml 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_yaml/version.rb +1 -1
- data/lib/active_yaml/yaml_hash.rb +11 -6
- 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: 9c066487217e81c6a2c31748288416cb7119548bb6c309ace6447f178b6b4fcf
|
4
|
+
data.tar.gz: a539f959b3b447b962971a6906b252113753ff31b29cb8800bb7b49fc00642bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58e3b1a95340185344f5d9b4525417356c15811804a0ac81158fbb14907729f38bf8af7dccf3e2fd9f63edffe005a4484d8bfabf7eea0d3fb25cc6e4ff06338e
|
7
|
+
data.tar.gz: 34fd61b532cb72001b64a2e4c464262733b022c8adb743aa3dbb3a57e9adcbfc0c0d81d7b9d7f8e2d3dcc762e17e59275b4c16d5cfb1c5dd2e97e2c4505b10d7
|
data/lib/active_yaml/version.rb
CHANGED
@@ -3,16 +3,21 @@
|
|
3
3
|
module ActiveYaml
|
4
4
|
# Class for creating hashes of similar objects
|
5
5
|
class YamlHash
|
6
|
-
attr_reader :hash
|
7
|
-
|
8
6
|
def initialize(hash)
|
9
7
|
@hash = hash || {}
|
10
8
|
end
|
11
9
|
|
10
|
+
# The method is used to obtain a hash from an incomplete call chain.
|
11
|
+
# By default, if there is a value from a method of the same name, it will be returned.
|
12
|
+
# Otherwise the current hash will be returned
|
13
|
+
def hash
|
14
|
+
@hash['hash'] || @hash
|
15
|
+
end
|
16
|
+
|
12
17
|
# The main logic of this class is implemented in this method.
|
13
18
|
# Allows you to filter method calls and redirect them to a hash by key
|
14
19
|
def method_missing(method, *args, &)
|
15
|
-
value = hash[method.to_s]
|
20
|
+
value = @hash[method.to_s]
|
16
21
|
|
17
22
|
if value
|
18
23
|
return self.class.new(value) if value.is_a?(Hash)
|
@@ -24,15 +29,15 @@ module ActiveYaml
|
|
24
29
|
end
|
25
30
|
|
26
31
|
def respond_to_missing?(method, include_private = false)
|
27
|
-
hash.key?(method.to_s) || super
|
32
|
+
@hash.key?(method.to_s) || super
|
28
33
|
end
|
29
34
|
|
30
35
|
def inspect
|
31
|
-
hash
|
36
|
+
@hash
|
32
37
|
end
|
33
38
|
|
34
39
|
def to_s
|
35
|
-
hash.to_s
|
40
|
+
@hash.to_s
|
36
41
|
end
|
37
42
|
end
|
38
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeyaml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill Leonov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: psych
|