zertico 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
data/lib/zertico/accessor.rb
CHANGED
@@ -27,19 +27,23 @@ module Zertico
|
|
27
27
|
protected
|
28
28
|
|
29
29
|
def self.interface_name
|
30
|
-
self.name.
|
30
|
+
self.interface_class.name.singularize.underscore
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
34
|
-
|
33
|
+
def self.interface_class
|
34
|
+
begin
|
35
|
+
self.name.chomp('Accessor').constantize
|
36
|
+
rescue NameError
|
37
|
+
self.name.chomp('Accessor').split('::').last.constantize
|
38
|
+
end
|
35
39
|
end
|
36
40
|
|
37
|
-
def
|
38
|
-
self.interface_name
|
41
|
+
def interface_name
|
42
|
+
self.class.interface_name
|
39
43
|
end
|
40
44
|
|
41
45
|
def interface_class
|
42
|
-
self.
|
46
|
+
self.class.interface_class
|
43
47
|
end
|
44
48
|
end
|
45
49
|
end
|
data/lib/zertico/version.rb
CHANGED
@@ -4,9 +4,21 @@ describe Zertico::Accessor do
|
|
4
4
|
let(:user) { User.new }
|
5
5
|
let(:user_accessor) { UserAccessor.new(user) }
|
6
6
|
|
7
|
-
|
8
|
-
it 'should
|
9
|
-
|
7
|
+
context 'on a namespaced accessor and interface model' do
|
8
|
+
it 'should find the interface model' do
|
9
|
+
Person::ProfileAccessor.send(:interface_class).should == Person::Profile
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'on a namespaced accessor and non namespaced interface model' do
|
14
|
+
it 'should find the interface model' do
|
15
|
+
Admin::UserAccessor.send(:interface_class).should == User
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'on a non namespaced accessor and non namespaced interface model' do
|
20
|
+
it 'should find the interface model' do
|
21
|
+
UserAccessor.send(:interface_class).should == User
|
10
22
|
end
|
11
23
|
end
|
12
24
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zertico
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -82,9 +82,11 @@ files:
|
|
82
82
|
- lib/zertico/controller.rb
|
83
83
|
- lib/zertico/service.rb
|
84
84
|
- lib/zertico/version.rb
|
85
|
+
- spec/fake_app/admin/user_accessor.rb
|
85
86
|
- spec/fake_app/admin/user_controller.rb
|
86
87
|
- spec/fake_app/admin/user_service.rb
|
87
88
|
- spec/fake_app/person/profile.rb
|
89
|
+
- spec/fake_app/person/profile_accessor.rb
|
88
90
|
- spec/fake_app/person/profile_controller.rb
|
89
91
|
- spec/fake_app/person/profile_service.rb
|
90
92
|
- spec/fake_app/user.rb
|
@@ -110,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
112
|
version: '0'
|
111
113
|
segments:
|
112
114
|
- 0
|
113
|
-
hash: -
|
115
|
+
hash: -1376972189915734398
|
114
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
117
|
none: false
|
116
118
|
requirements:
|
@@ -119,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
121
|
version: '0'
|
120
122
|
segments:
|
121
123
|
- 0
|
122
|
-
hash: -
|
124
|
+
hash: -1376972189915734398
|
123
125
|
requirements: []
|
124
126
|
rubyforge_project:
|
125
127
|
rubygems_version: 1.8.25
|
@@ -129,9 +131,11 @@ summary: Models and patterns used by Zertico
|
|
129
131
|
test_files:
|
130
132
|
- gemfiles/Gemfile.rails3.1
|
131
133
|
- gemfiles/Gemfile.rails3.2
|
134
|
+
- spec/fake_app/admin/user_accessor.rb
|
132
135
|
- spec/fake_app/admin/user_controller.rb
|
133
136
|
- spec/fake_app/admin/user_service.rb
|
134
137
|
- spec/fake_app/person/profile.rb
|
138
|
+
- spec/fake_app/person/profile_accessor.rb
|
135
139
|
- spec/fake_app/person/profile_controller.rb
|
136
140
|
- spec/fake_app/person/profile_service.rb
|
137
141
|
- spec/fake_app/user.rb
|