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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a8d108b1c124908ffe44ae01cb07d736d52b8454ce3d49d66f00e696f7b1843
4
- data.tar.gz: 4d8109a4f67c12f604020618d0f04ff563893fefcf463471b0557bb5bd19e606
3
+ metadata.gz: a6a2fb0f23004b01f24e25eb9a8ffe5c78ee2d4eb93c7eba9e7e1711ff23fe28
4
+ data.tar.gz: 285dfc3ca665389c03628214265e2c5ef37212d110d6421ebe2947e0634ea036
5
5
  SHA512:
6
- metadata.gz: 02c9d24192ec0020b8559a02ae77bbbab0e4746cae0b83ca8456292f095cfa665f3cdd37c62159a0fa721392f3f9aae2dd90de93950325ec9b20b582a19c1496
7
- data.tar.gz: c710ab2e273803af665dc22fd2f1b2c9fd10d48b3cf9a21e06ee819f9dc77ad7bc857123ce275cbbaadd0f2768a08b181ae22c0dc6c27546a1de2850fa7eb55f
6
+ metadata.gz: 2d9b6eb136a787b55b53c6791abe168bbf0b04bc37827a059b563a75556145f5089d2b9a05decae94061280ca0a74588eaf8bf2c0a65a880584c3423d5b77aad
7
+ data.tar.gz: 5f5f7200a00978fe0b61a5c7cc610ea11eeae32702b14d3b86a37359b7ee55400605a94bfbce68372ba40c1b9b137e2a91cfd4fb854a7de7e115ea0b3b6db683
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ /.idea/
@@ -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
- class_name=base_names.map { |x| x.gsub(/^#{self.class.name.underscore}_/, '') }
9
- 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
10
- @children_names||=base_names | class_name
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
- match_data[2][0..2] == 'is_' ? match_data[2][3..6] == 'not_' : nil
52
+ nil
52
53
  end
53
54
  rescue Exception
54
55
  raise e
@@ -1,3 +1,3 @@
1
1
  module AutoDemeter
2
- VERSION = '0.0.10'
2
+ VERSION = '0.0.11'
3
3
  end
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.10
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: 2020-06-05 00:00:00.000000000 Z
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.0.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: