auto_demeter 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/auto_demeter/methods.rb +8 -7
- data/lib/auto_demeter/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6a2fb0f23004b01f24e25eb9a8ffe5c78ee2d4eb93c7eba9e7e1711ff23fe28
|
4
|
+
data.tar.gz: 285dfc3ca665389c03628214265e2c5ef37212d110d6421ebe2947e0634ea036
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d9b6eb136a787b55b53c6791abe168bbf0b04bc37827a059b563a75556145f5089d2b9a05decae94061280ca0a74588eaf8bf2c0a65a880584c3423d5b77aad
|
7
|
+
data.tar.gz: 5f5f7200a00978fe0b61a5c7cc610ea11eeae32702b14d3b86a37359b7ee55400605a94bfbce68372ba40c1b9b137e2a91cfd4fb854a7de7e115ea0b3b6db683
|
data/.gitignore
CHANGED
data/lib/auto_demeter/methods.rb
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
module AutoDemeter
|
2
2
|
private
|
3
3
|
def base_names
|
4
|
-
@base_names||=self.class.reflect_on_all_associations.find_all { |x| [:has_one, :belongs_to].include?(x.send(:macro)) }.map { |x| x.send(:name).to_s }
|
4
|
+
@base_names||=self.class.reflect_on_all_associations.find_all { |x| [:has_one, :belongs_to].include?(x.send(:macro)) }.map { |x| x.send(:name).to_s } rescue []
|
5
5
|
end
|
6
6
|
|
7
7
|
def children_names
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
if @children_names.nil?
|
9
|
+
class_name=base_names.map { |x| x.gsub(/^#{self.class.name.underscore}_/, '') }
|
10
|
+
class_name=class_name | base_names.map { |x| x.gsub(/^#{self.base_name.underscore}_/, '') } if self.respond_to?(:base_name) && self.class.name!=self.base_name
|
11
|
+
@children_names=base_names | class_name
|
12
|
+
end
|
13
|
+
@children_names
|
11
14
|
end
|
12
15
|
|
13
16
|
def reflected_children_regex
|
@@ -23,8 +26,6 @@ module AutoDemeter
|
|
23
26
|
association.respond_to?(match_data[2])
|
24
27
|
elsif association.nil?
|
25
28
|
association_name.camelize.constantize.new.respond_to?(match_data[2])
|
26
|
-
else
|
27
|
-
match_data[2][0..2] == 'is_'
|
28
29
|
end
|
29
30
|
rescue
|
30
31
|
false
|
@@ -48,7 +49,7 @@ module AutoDemeter
|
|
48
49
|
if association=send(association_name)
|
49
50
|
association.send(match_data[2], *args, &block)
|
50
51
|
else
|
51
|
-
|
52
|
+
nil
|
52
53
|
end
|
53
54
|
rescue Exception
|
54
55
|
raise e
|
data/lib/auto_demeter/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auto_demeter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul McKibbin
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sqlite3
|
@@ -108,7 +108,7 @@ homepage: ''
|
|
108
108
|
licenses:
|
109
109
|
- MIT
|
110
110
|
metadata: {}
|
111
|
-
post_install_message:
|
111
|
+
post_install_message:
|
112
112
|
rdoc_options: []
|
113
113
|
require_paths:
|
114
114
|
- lib
|
@@ -123,8 +123,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
|
-
rubygems_version: 3.
|
127
|
-
signing_key:
|
126
|
+
rubygems_version: 3.1.4
|
127
|
+
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: Automated demeter methods
|
130
130
|
test_files:
|