guise 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +14 -0
- data/Appraisals +9 -2
- data/README.md +68 -21
- data/Rakefile +2 -0
- data/gemfiles/3.1.gemfile +2 -1
- data/gemfiles/3.1.gemfile.lock +47 -37
- data/gemfiles/3.2.gemfile +2 -1
- data/gemfiles/3.2.gemfile.lock +46 -36
- data/gemfiles/4.0.gemfile +8 -0
- data/gemfiles/4.0.gemfile.lock +74 -0
- data/guise.gemspec +18 -7
- data/lib/guise/callbacks.rb +28 -0
- data/lib/guise/introspection.rb +15 -16
- data/lib/guise/registry.rb +0 -0
- data/lib/guise/syntax.rb +104 -0
- data/lib/guise/version.rb +1 -1
- data/lib/guise.rb +7 -71
- data/spec/factories.rb +12 -5
- data/spec/guise_spec.rb +107 -43
- data/spec/spec_helper.rb +43 -6
- metadata +116 -52
- data/lib/guise/options.rb +0 -25
- data/spec/support/database.rb +0 -40
metadata
CHANGED
@@ -1,102 +1,163 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Eduardo Gutierrez
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-03-04 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activerecord
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '3.1'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '4.1'
|
22
23
|
type: :runtime
|
23
24
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.1'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '4.1'
|
25
33
|
- !ruby/object:Gem::Dependency
|
26
34
|
name: activesupport
|
27
|
-
requirement:
|
28
|
-
none: false
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
29
36
|
requirements:
|
30
|
-
- -
|
37
|
+
- - ">="
|
31
38
|
- !ruby/object:Gem::Version
|
32
39
|
version: '3.1'
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '4.1'
|
33
43
|
type: :runtime
|
34
44
|
prerelease: false
|
35
|
-
version_requirements:
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '3.1'
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '4.1'
|
36
53
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement:
|
39
|
-
none: false
|
54
|
+
name: rake
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
40
56
|
requirements:
|
41
|
-
- - ~>
|
57
|
+
- - "~>"
|
42
58
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
59
|
+
version: '10.1'
|
44
60
|
type: :development
|
45
61
|
prerelease: false
|
46
|
-
version_requirements:
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '10.1'
|
47
67
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement:
|
50
|
-
none: false
|
68
|
+
name: rspec
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
51
70
|
requirements:
|
52
|
-
- - ~>
|
71
|
+
- - "~>"
|
53
72
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
73
|
+
version: '2.14'
|
55
74
|
type: :development
|
56
75
|
prerelease: false
|
57
|
-
version_requirements:
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '2.14'
|
58
81
|
- !ruby/object:Gem::Dependency
|
59
82
|
name: factory_girl
|
60
|
-
requirement:
|
61
|
-
none: false
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
62
84
|
requirements:
|
63
|
-
- - ~>
|
85
|
+
- - "~>"
|
64
86
|
- !ruby/object:Gem::Version
|
65
|
-
version: '
|
87
|
+
version: '4.4'
|
66
88
|
type: :development
|
67
89
|
prerelease: false
|
68
|
-
version_requirements:
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - "~>"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '4.4'
|
69
95
|
- !ruby/object:Gem::Dependency
|
70
96
|
name: shoulda-matchers
|
71
|
-
requirement:
|
72
|
-
none: false
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
73
98
|
requirements:
|
74
|
-
- - ~>
|
99
|
+
- - "~>"
|
75
100
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
101
|
+
version: '2.5'
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - "~>"
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '2.5'
|
80
109
|
- !ruby/object:Gem::Dependency
|
81
110
|
name: appraisal
|
82
|
-
requirement:
|
83
|
-
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - "~>"
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0.5'
|
116
|
+
type: :development
|
117
|
+
prerelease: false
|
118
|
+
version_requirements: !ruby/object:Gem::Requirement
|
84
119
|
requirements:
|
85
|
-
- -
|
120
|
+
- - "~>"
|
86
121
|
- !ruby/object:Gem::Version
|
87
|
-
version: '0'
|
122
|
+
version: '0.5'
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
name: pry
|
125
|
+
requirement: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - "~>"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0.9'
|
88
130
|
type: :development
|
89
131
|
prerelease: false
|
90
|
-
version_requirements:
|
91
|
-
|
132
|
+
version_requirements: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - "~>"
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0.9'
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: sqlite3
|
139
|
+
requirement: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - "~>"
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '1.3'
|
144
|
+
type: :development
|
145
|
+
prerelease: false
|
146
|
+
version_requirements: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - "~>"
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '1.3'
|
151
|
+
description: " Multiple inheritance STI "
|
92
152
|
email:
|
93
153
|
- edd_d@mit.edu
|
94
154
|
executables: []
|
95
155
|
extensions: []
|
96
156
|
extra_rdoc_files: []
|
97
157
|
files:
|
98
|
-
- .gitignore
|
99
|
-
- .rspec
|
158
|
+
- ".gitignore"
|
159
|
+
- ".rspec"
|
160
|
+
- ".travis.yml"
|
100
161
|
- Appraisals
|
101
162
|
- Gemfile
|
102
163
|
- LICENSE
|
@@ -106,42 +167,45 @@ files:
|
|
106
167
|
- gemfiles/3.1.gemfile.lock
|
107
168
|
- gemfiles/3.2.gemfile
|
108
169
|
- gemfiles/3.2.gemfile.lock
|
170
|
+
- gemfiles/4.0.gemfile
|
171
|
+
- gemfiles/4.0.gemfile.lock
|
109
172
|
- guise.gemspec
|
110
173
|
- lib/guise.rb
|
174
|
+
- lib/guise/callbacks.rb
|
111
175
|
- lib/guise/introspection.rb
|
112
|
-
- lib/guise/
|
176
|
+
- lib/guise/registry.rb
|
177
|
+
- lib/guise/syntax.rb
|
113
178
|
- lib/guise/version.rb
|
114
179
|
- spec/factories.rb
|
115
180
|
- spec/guise_spec.rb
|
116
181
|
- spec/spec_helper.rb
|
117
|
-
- spec/support/database.rb
|
118
182
|
homepage: https://github.com/ecbypi/guise
|
119
|
-
licenses:
|
183
|
+
licenses:
|
184
|
+
- MIT
|
185
|
+
metadata: {}
|
120
186
|
post_install_message:
|
121
187
|
rdoc_options: []
|
122
188
|
require_paths:
|
123
189
|
- lib
|
124
190
|
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
-
none: false
|
126
191
|
requirements:
|
127
|
-
- -
|
192
|
+
- - ">="
|
128
193
|
- !ruby/object:Gem::Version
|
129
|
-
version:
|
194
|
+
version: 1.9.3
|
130
195
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
-
none: false
|
132
196
|
requirements:
|
133
|
-
- -
|
197
|
+
- - ">="
|
134
198
|
- !ruby/object:Gem::Version
|
135
199
|
version: '0'
|
136
200
|
requirements: []
|
137
201
|
rubyforge_project:
|
138
|
-
rubygems_version:
|
202
|
+
rubygems_version: 2.2.0
|
139
203
|
signing_key:
|
140
|
-
specification_version:
|
204
|
+
specification_version: 4
|
141
205
|
summary: Guise provides methods to setup single table inheritance with multiple inheritances
|
142
206
|
possible.
|
143
207
|
test_files:
|
144
208
|
- spec/factories.rb
|
145
209
|
- spec/guise_spec.rb
|
146
210
|
- spec/spec_helper.rb
|
147
|
-
|
211
|
+
has_rdoc:
|
data/lib/guise/options.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
module Guise
|
2
|
-
module Options
|
3
|
-
def extract_guise_options(names, options)
|
4
|
-
@@guise_options = {
|
5
|
-
:association => options.delete(:association) || :guises,
|
6
|
-
:attribute => options.delete(:attribute) || :title,
|
7
|
-
:names => names
|
8
|
-
}
|
9
|
-
|
10
|
-
return @@guise_options, options
|
11
|
-
end
|
12
|
-
|
13
|
-
def guises
|
14
|
-
@@guise_options[:names]
|
15
|
-
end
|
16
|
-
|
17
|
-
def guise_association
|
18
|
-
@@guise_options[:association]
|
19
|
-
end
|
20
|
-
|
21
|
-
def guise_attribute
|
22
|
-
@@guise_options[:attribute]
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/spec/support/database.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# Inspired/borrowed from @ernie's way of building out a database in
|
2
|
-
# ransack and squeel
|
3
|
-
|
4
|
-
ActiveRecord::Base.establish_connection(
|
5
|
-
:adapter => 'sqlite3',
|
6
|
-
:database => ':memory:'
|
7
|
-
)
|
8
|
-
|
9
|
-
class User < ActiveRecord::Base
|
10
|
-
has_guises :Technician, :Supervisor,
|
11
|
-
:association => :user_roles,
|
12
|
-
:attribute => :name,
|
13
|
-
:foreign_key => :person_id
|
14
|
-
end
|
15
|
-
|
16
|
-
class UserRole < ActiveRecord::Base
|
17
|
-
guise_for :user,
|
18
|
-
:foreign_key => :person_id
|
19
|
-
end
|
20
|
-
|
21
|
-
|
22
|
-
module Database
|
23
|
-
def self.create
|
24
|
-
ActiveRecord::Base.silence do
|
25
|
-
ActiveRecord::Migration.verbose = false
|
26
|
-
|
27
|
-
ActiveRecord::Schema.define do
|
28
|
-
create_table :users, :force => true do |t|
|
29
|
-
t.string :name
|
30
|
-
t.string :email
|
31
|
-
end
|
32
|
-
|
33
|
-
create_table :user_roles, :force => true do |t|
|
34
|
-
t.string :name
|
35
|
-
t.integer :person_id
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|