activeyaml 1.2.1 → 1.2.3
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/method_mapping.rb +1 -1
- data/lib/active_yaml/version.rb +1 -1
- data/lib/active_yaml/yaml_hash.rb +12 -7
- data/lib/activeyaml.rb +3 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34a8210111d3936d5b8cb7920578910bdcd291d36dab58522daa9224246c3322
|
4
|
+
data.tar.gz: cbbc821bc9bfc5665136bf06c3f1875c84eac68787fba94b974ae7a39702d231
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a062cbe0579482d39ed5cf78f8fd0691287a7c3edb9183d3930ae6b30c042a8b0e20dc46a183687caca4038d3788ea7b65d4371bc31d16c4f3fb4c827ca01f66
|
7
|
+
data.tar.gz: 1fe2e0ad2aeea0218f44ee97f574cd88a4d2d951e3559da6fccb98178db98deca0ad222c416825e7326e37a9d5aac9845d45884131b23d95809ca777bee1bba6
|
@@ -6,7 +6,7 @@ module ActiveYaml
|
|
6
6
|
# A module containing methods that allow you to track method calls,
|
7
7
|
# and compare them with data from the YML file
|
8
8
|
module MethodMapping
|
9
|
-
def method_missing(method, *args, &)
|
9
|
+
def method_missing(method, *args, &block)
|
10
10
|
value = yaml_data[method.to_s]
|
11
11
|
|
12
12
|
if value
|
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
|
-
def method_missing(method, *args, &)
|
15
|
-
value = hash[method.to_s]
|
19
|
+
def method_missing(method, *args, &block)
|
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
|
data/lib/activeyaml.rb
ADDED
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill Leonov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: psych
|
@@ -37,6 +37,7 @@ files:
|
|
37
37
|
- lib/active_yaml/parser.rb
|
38
38
|
- lib/active_yaml/version.rb
|
39
39
|
- lib/active_yaml/yaml_hash.rb
|
40
|
+
- lib/activeyaml.rb
|
40
41
|
homepage: https://github.com/leonovk/activeyaml
|
41
42
|
licenses:
|
42
43
|
- MIT
|
@@ -52,14 +53,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
53
|
requirements:
|
53
54
|
- - ">="
|
54
55
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
56
|
+
version: '2.4'
|
56
57
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
58
|
requirements:
|
58
59
|
- - ">="
|
59
60
|
- !ruby/object:Gem::Version
|
60
61
|
version: '0'
|
61
62
|
requirements: []
|
62
|
-
rubygems_version: 3.
|
63
|
+
rubygems_version: 3.1.6
|
63
64
|
signing_key:
|
64
65
|
specification_version: 4
|
65
66
|
summary: yaml object-relational mapping
|