auto_demeter 0.0.7c → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,19 +1,20 @@
1
1
  module AutoDemeter
2
2
  private
3
3
  def base_names
4
- @base_names ||= self.class.reflect_on_all_associations.map{|x| x.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 }
5
5
  end
6
6
 
7
7
  def children_names
8
8
  class_name=base_names.map { |x| x.gsub(/^#{self.class.name.underscore}_/, '') }
9
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
10
+ @children_names||=base_names | class_name
11
11
  end
12
12
 
13
13
  def reflected_children_regex
14
- Regexp.new('^(' << children_names.join('|') << ')(?:\.|_|&.)(.*[^=])$')
14
+ Regexp.new('^(' << children_names.join('|') << ')_(.*[^=])$')
15
15
  end
16
16
 
17
+ public
17
18
  def respond_through_association?(method_id)
18
19
  if children_names && (match_data=method_id.to_s.match(reflected_children_regex)) && match_data[1].present?
19
20
  association_name=self.methods.include?(match_data[1]) ? match_data[1] : "#{self.class.name.underscore}_#{match_data[1]}"
@@ -31,8 +32,7 @@ module AutoDemeter
31
32
  end
32
33
  end
33
34
 
34
- public
35
- def respond_to?(method_id)
35
+ def respond_to?(method_id, public=false)
36
36
  super || (method_id != :base_name && respond_through_association?(method_id))
37
37
  end
38
38
 
@@ -1,3 +1,3 @@
1
1
  module AutoDemeter
2
- VERSION = '0.0.7c'
2
+ VERSION = '0.0.7'
3
3
  end
metadata CHANGED
@@ -1,104 +1,105 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: auto_demeter
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.7c
5
- prerelease: 5
3
+ version: !ruby/object:Gem::Version
4
+ hash: 17
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 7
10
+ version: 0.0.7
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Paul McKibbin
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2016-06-06 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2016-08-01 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: sqlite3
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :development
23
22
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: bundler
32
- requirement: !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
33
24
  none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
38
32
  type: :development
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: bundler
39
36
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
37
+ requirement: &id002 !ruby/object:Gem::Requirement
41
38
  none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: rake
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ hash: 9
43
+ segments:
44
+ - 1
45
+ - 3
46
+ version: "1.3"
54
47
  type: :development
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: rake
55
51
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: active_record
64
- requirement: !ruby/object:Gem::Requirement
52
+ requirement: &id003 !ruby/object:Gem::Requirement
65
53
  none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ hash: 63
58
+ segments:
59
+ - 0
60
+ - 9
61
+ - 2
62
+ version: 0.9.2
70
63
  type: :development
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: activerecord
71
67
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
68
+ requirement: &id004 !ruby/object:Gem::Requirement
73
69
  none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- - !ruby/object:Gem::Dependency
79
- name: simplecov
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '0'
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
86
77
  type: :development
78
+ version_requirements: *id004
79
+ - !ruby/object:Gem::Dependency
80
+ name: rcov
87
81
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
82
+ requirement: &id005 !ruby/object:Gem::Requirement
89
83
  none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
94
- description: Create automated methods for all children or parents to allow a request
95
- to be handled more easily than defining a long chain
96
- email:
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ type: :development
92
+ version_requirements: *id005
93
+ description: Create automated methods for all children or parents to allow a request to be handled more easily than defining a long chain
94
+ email:
97
95
  - pmckibbin@gmail.com
98
96
  executables: []
97
+
99
98
  extensions: []
99
+
100
100
  extra_rdoc_files: []
101
- files:
101
+
102
+ files:
102
103
  - .gitignore
103
104
  - Gemfile
104
105
  - LICENSE.txt
@@ -109,30 +110,38 @@ files:
109
110
  - lib/auto_demeter/methods.rb
110
111
  - lib/auto_demeter/version.rb
111
112
  - test/auto_demeter_test.rb
112
- homepage: ''
113
- licenses:
113
+ homepage: ""
114
+ licenses:
114
115
  - MIT
115
116
  post_install_message:
116
117
  rdoc_options: []
117
- require_paths:
118
+
119
+ require_paths:
118
120
  - lib
119
- required_ruby_version: !ruby/object:Gem::Requirement
121
+ required_ruby_version: !ruby/object:Gem::Requirement
120
122
  none: false
121
- requirements:
122
- - - ! '>='
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ hash: 3
127
+ segments:
128
+ - 0
129
+ version: "0"
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
131
  none: false
127
- requirements:
128
- - - ! '>'
129
- - !ruby/object:Gem::Version
130
- version: 1.3.1
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ hash: 3
136
+ segments:
137
+ - 0
138
+ version: "0"
131
139
  requirements: []
140
+
132
141
  rubyforge_project:
133
- rubygems_version: 1.8.25
142
+ rubygems_version: 1.8.15
134
143
  signing_key:
135
144
  specification_version: 3
136
145
  summary: Automated demeter methods
137
- test_files:
146
+ test_files:
138
147
  - test/auto_demeter_test.rb