anchormodel 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +5 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +206 -0
- data/README.md +10 -5
- data/Rakefile +23 -3
- data/anchormodel.gemspec +26 -10
- data/doc/Anchormodel/ActiveModelTypeValue.html +10 -6
- data/doc/Anchormodel/Attribute.html +21 -14
- data/doc/Anchormodel/ModelMixin.html +14 -9
- data/doc/Anchormodel/Version.html +3 -3
- data/doc/Anchormodel.html +141 -53
- data/doc/_index.html +2 -2
- data/doc/file.README.html +37 -48
- data/doc/index.html +37 -48
- data/doc/method_list.html +8 -0
- data/doc/top-level-namespace.html +2 -2
- data/lib/anchormodel/attribute.rb +2 -2
- data/lib/anchormodel/model_mixin.rb +1 -1
- data/lib/anchormodel/version.rb +2 -2
- data/lib/anchormodel.rb +2 -2
- data/logo.svg +98 -0
- data/test/active_record_model/user_test.rb +51 -0
- data/test/dummy/.gitignore +29 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/anchormodels/locale.rb +6 -0
- data/test/dummy/app/anchormodels/role.rb +14 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/application_record.rb +5 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/models/user.rb +4 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +33 -0
- data/test/dummy/config/application.rb +37 -0
- data/test/dummy/config/boot.rb +3 -0
- data/test/dummy/config/credentials.yml.enc +1 -0
- data/test/dummy/config/database.yml +8 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/test.rb +50 -0
- data/test/dummy/config/initializers/content_security_policy.rb +25 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +8 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/permissions_policy.rb +11 -0
- data/test/dummy/config/locales/en.yml +33 -0
- data/test/dummy/config/puma.rb +43 -0
- data/test/dummy/config/routes.rb +6 -0
- data/test/dummy/config.ru +6 -0
- data/test/dummy/db/migrate/20230107173151_create_users.rb +10 -0
- data/test/dummy/db/schema.rb +21 -0
- data/test/dummy/db/seeds.rb +7 -0
- data/test/dummy/lib/tasks/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/tmp/.keep +0 -0
- data/test/dummy/tmp/pids/.keep +0 -0
- data/test/test_helper.rb +21 -0
- metadata +148 -13
- data/anchormodel-0.0.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d456af4c2d49001651318271fd70c8e008894cf7b2a0a1beeb0bc28e3f8aa227
|
4
|
+
data.tar.gz: 4801071bbe71a06f16717b25ff657a90989bdd801624eecc6388bdea5cbb216e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd9483b0df7c815393b58e7f2b39176f819f6f94c3cc06cce7722daba928f938a0eeb4c55659225d3d6dd25f4a278da75c115b3faf67adff6b5481627b35d186
|
7
|
+
data.tar.gz: 1fce2625be81e4f348c3ddd9198a9dec75d2b39454322059adffee8714aa65c8758ad877655862c1e86c8e4219ba7e1ffbba2a78401eb6a87bcd0dd2170d5981
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.1.3
|
data/CHANGELOG.md
CHANGED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,206 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
anchormodel (0.0.3.edge)
|
5
|
+
rails (~> 7.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actioncable (7.0.4)
|
11
|
+
actionpack (= 7.0.4)
|
12
|
+
activesupport (= 7.0.4)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
actionmailbox (7.0.4)
|
16
|
+
actionpack (= 7.0.4)
|
17
|
+
activejob (= 7.0.4)
|
18
|
+
activerecord (= 7.0.4)
|
19
|
+
activestorage (= 7.0.4)
|
20
|
+
activesupport (= 7.0.4)
|
21
|
+
mail (>= 2.7.1)
|
22
|
+
net-imap
|
23
|
+
net-pop
|
24
|
+
net-smtp
|
25
|
+
actionmailer (7.0.4)
|
26
|
+
actionpack (= 7.0.4)
|
27
|
+
actionview (= 7.0.4)
|
28
|
+
activejob (= 7.0.4)
|
29
|
+
activesupport (= 7.0.4)
|
30
|
+
mail (~> 2.5, >= 2.5.4)
|
31
|
+
net-imap
|
32
|
+
net-pop
|
33
|
+
net-smtp
|
34
|
+
rails-dom-testing (~> 2.0)
|
35
|
+
actionpack (7.0.4)
|
36
|
+
actionview (= 7.0.4)
|
37
|
+
activesupport (= 7.0.4)
|
38
|
+
rack (~> 2.0, >= 2.2.0)
|
39
|
+
rack-test (>= 0.6.3)
|
40
|
+
rails-dom-testing (~> 2.0)
|
41
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
42
|
+
actiontext (7.0.4)
|
43
|
+
actionpack (= 7.0.4)
|
44
|
+
activerecord (= 7.0.4)
|
45
|
+
activestorage (= 7.0.4)
|
46
|
+
activesupport (= 7.0.4)
|
47
|
+
globalid (>= 0.6.0)
|
48
|
+
nokogiri (>= 1.8.5)
|
49
|
+
actionview (7.0.4)
|
50
|
+
activesupport (= 7.0.4)
|
51
|
+
builder (~> 3.1)
|
52
|
+
erubi (~> 1.4)
|
53
|
+
rails-dom-testing (~> 2.0)
|
54
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
55
|
+
activejob (7.0.4)
|
56
|
+
activesupport (= 7.0.4)
|
57
|
+
globalid (>= 0.3.6)
|
58
|
+
activemodel (7.0.4)
|
59
|
+
activesupport (= 7.0.4)
|
60
|
+
activerecord (7.0.4)
|
61
|
+
activemodel (= 7.0.4)
|
62
|
+
activesupport (= 7.0.4)
|
63
|
+
activestorage (7.0.4)
|
64
|
+
actionpack (= 7.0.4)
|
65
|
+
activejob (= 7.0.4)
|
66
|
+
activerecord (= 7.0.4)
|
67
|
+
activesupport (= 7.0.4)
|
68
|
+
marcel (~> 1.0)
|
69
|
+
mini_mime (>= 1.1.0)
|
70
|
+
activesupport (7.0.4)
|
71
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
72
|
+
i18n (>= 1.6, < 2)
|
73
|
+
minitest (>= 5.1)
|
74
|
+
tzinfo (~> 2.0)
|
75
|
+
ansi (1.5.0)
|
76
|
+
ast (2.4.2)
|
77
|
+
builder (3.2.4)
|
78
|
+
coderay (1.1.3)
|
79
|
+
concurrent-ruby (1.1.10)
|
80
|
+
crass (1.0.6)
|
81
|
+
date (3.3.3)
|
82
|
+
erubi (1.12.0)
|
83
|
+
globalid (1.0.0)
|
84
|
+
activesupport (>= 5.0)
|
85
|
+
i18n (1.12.0)
|
86
|
+
concurrent-ruby (~> 1.0)
|
87
|
+
json (2.6.3)
|
88
|
+
loofah (2.19.1)
|
89
|
+
crass (~> 1.0.2)
|
90
|
+
nokogiri (>= 1.5.9)
|
91
|
+
mail (2.8.0)
|
92
|
+
mini_mime (>= 0.1.1)
|
93
|
+
net-imap
|
94
|
+
net-pop
|
95
|
+
net-smtp
|
96
|
+
marcel (1.0.2)
|
97
|
+
method_source (1.0.0)
|
98
|
+
mini_mime (1.1.2)
|
99
|
+
minitest (5.17.0)
|
100
|
+
minitest-reporters (1.5.0)
|
101
|
+
ansi
|
102
|
+
builder
|
103
|
+
minitest (>= 5.0)
|
104
|
+
ruby-progressbar
|
105
|
+
net-imap (0.3.4)
|
106
|
+
date
|
107
|
+
net-protocol
|
108
|
+
net-pop (0.1.2)
|
109
|
+
net-protocol
|
110
|
+
net-protocol (0.2.1)
|
111
|
+
timeout
|
112
|
+
net-smtp (0.3.3)
|
113
|
+
net-protocol
|
114
|
+
nio4r (2.5.8)
|
115
|
+
nokogiri (1.13.10-x86_64-linux)
|
116
|
+
racc (~> 1.4)
|
117
|
+
parallel (1.22.1)
|
118
|
+
parser (3.2.0.0)
|
119
|
+
ast (~> 2.4.1)
|
120
|
+
pry (0.14.1)
|
121
|
+
coderay (~> 1.1)
|
122
|
+
method_source (~> 1.0)
|
123
|
+
racc (1.6.2)
|
124
|
+
rack (2.2.5)
|
125
|
+
rack-test (2.0.2)
|
126
|
+
rack (>= 1.3)
|
127
|
+
rails (7.0.4)
|
128
|
+
actioncable (= 7.0.4)
|
129
|
+
actionmailbox (= 7.0.4)
|
130
|
+
actionmailer (= 7.0.4)
|
131
|
+
actionpack (= 7.0.4)
|
132
|
+
actiontext (= 7.0.4)
|
133
|
+
actionview (= 7.0.4)
|
134
|
+
activejob (= 7.0.4)
|
135
|
+
activemodel (= 7.0.4)
|
136
|
+
activerecord (= 7.0.4)
|
137
|
+
activestorage (= 7.0.4)
|
138
|
+
activesupport (= 7.0.4)
|
139
|
+
bundler (>= 1.15.0)
|
140
|
+
railties (= 7.0.4)
|
141
|
+
rails-dom-testing (2.0.3)
|
142
|
+
activesupport (>= 4.2.0)
|
143
|
+
nokogiri (>= 1.6)
|
144
|
+
rails-html-sanitizer (1.4.4)
|
145
|
+
loofah (~> 2.19, >= 2.19.1)
|
146
|
+
railties (7.0.4)
|
147
|
+
actionpack (= 7.0.4)
|
148
|
+
activesupport (= 7.0.4)
|
149
|
+
method_source
|
150
|
+
rake (>= 12.2)
|
151
|
+
thor (~> 1.0)
|
152
|
+
zeitwerk (~> 2.5)
|
153
|
+
rainbow (3.1.1)
|
154
|
+
rake (13.0.6)
|
155
|
+
regexp_parser (2.6.1)
|
156
|
+
rexml (3.2.5)
|
157
|
+
rubocop (1.43.0)
|
158
|
+
json (~> 2.3)
|
159
|
+
parallel (~> 1.10)
|
160
|
+
parser (>= 3.2.0.0)
|
161
|
+
rainbow (>= 2.2.2, < 4.0)
|
162
|
+
regexp_parser (>= 1.8, < 3.0)
|
163
|
+
rexml (>= 3.2.5, < 4.0)
|
164
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
165
|
+
ruby-progressbar (~> 1.7)
|
166
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
167
|
+
rubocop-ast (1.24.1)
|
168
|
+
parser (>= 3.1.1.0)
|
169
|
+
rubocop-rails (2.17.4)
|
170
|
+
activesupport (>= 4.2.0)
|
171
|
+
rack (>= 1.1)
|
172
|
+
rubocop (>= 1.33.0, < 2.0)
|
173
|
+
ruby-progressbar (1.11.0)
|
174
|
+
sqlite3 (1.6.0-x86_64-linux)
|
175
|
+
thor (1.2.1)
|
176
|
+
timeout (0.3.1)
|
177
|
+
tzinfo (2.0.5)
|
178
|
+
concurrent-ruby (~> 1.0)
|
179
|
+
unicode-display_width (2.4.2)
|
180
|
+
webrick (1.7.0)
|
181
|
+
websocket-driver (0.7.5)
|
182
|
+
websocket-extensions (>= 0.1.0)
|
183
|
+
websocket-extensions (0.1.5)
|
184
|
+
yard (0.9.28)
|
185
|
+
webrick (~> 1.7.0)
|
186
|
+
yard-activesupport-concern (0.0.1)
|
187
|
+
yard (>= 0.8)
|
188
|
+
zeitwerk (2.6.6)
|
189
|
+
|
190
|
+
PLATFORMS
|
191
|
+
x86_64-linux
|
192
|
+
|
193
|
+
DEPENDENCIES
|
194
|
+
anchormodel!
|
195
|
+
minitest (~> 5.17.0)
|
196
|
+
minitest-reporters (~> 1.5.0)
|
197
|
+
pry (~> 0.14.1)
|
198
|
+
rake (~> 13.0.6)
|
199
|
+
rubocop (~> 1.43.0)
|
200
|
+
rubocop-rails (~> 2.17.4)
|
201
|
+
sqlite3 (~> 1.6.0)
|
202
|
+
yard (~> 0.9.28)
|
203
|
+
yard-activesupport-concern (~> 0.0.1)
|
204
|
+
|
205
|
+
BUNDLED WITH
|
206
|
+
2.3.26
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
<img src="logo.svg" height=250 alt="Anchormodel logo"/>
|
2
|
+
|
1
3
|
# Introducing Anchormodel
|
2
4
|
|
3
5
|
This gem provides a simple but powerful alternative to [Rails
|
@@ -47,13 +49,16 @@ entries of an Anchormodel.
|
|
47
49
|
`app/anchormodels/role.rb`:
|
48
50
|
|
49
51
|
```ruby
|
50
|
-
class
|
52
|
+
class Role < Anchormodel
|
53
|
+
# Make <, > etc. based on <=> operator whic hwe will define below
|
54
|
+
include Comparable
|
55
|
+
|
51
56
|
# Expose the attribute privilege_level
|
52
57
|
attr_reader :privilege_level
|
53
58
|
|
54
|
-
#
|
59
|
+
# Define <=> to make user roles comparable based on the privilege level
|
55
60
|
def <=>(other)
|
56
|
-
|
61
|
+
@privilege_level <=> other.privilege_level
|
57
62
|
end
|
58
63
|
|
59
64
|
# Declare all available roles
|
@@ -76,10 +81,10 @@ You may now use the following methods:
|
|
76
81
|
|
77
82
|
```ruby
|
78
83
|
# Retrieve all user roles:
|
79
|
-
|
84
|
+
Role.all
|
80
85
|
|
81
86
|
# Retrieve a specific role from the String and find its privilege level
|
82
|
-
|
87
|
+
Role.find(:guest).privilege_level
|
83
88
|
|
84
89
|
# Implement a Rails helper that makes sure users can only edit other users that have a lower privilege level than themselves
|
85
90
|
def user_can_edit?(this_user, other_user)
|
data/Rakefile
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
require_relative 'lib/anchormodel/version'
|
3
3
|
|
4
|
+
# Create "gemspec" task
|
4
5
|
task :gemspec do
|
5
6
|
specification = Gem::Specification.new do |s|
|
6
7
|
s.name = 'anchormodel'
|
@@ -11,12 +12,27 @@ task :gemspec do
|
|
11
12
|
s.executables = []
|
12
13
|
s.require_paths = ['lib']
|
13
14
|
s.required_ruby_version = '>= 3.0.0'
|
15
|
+
s.license = 'LGPL-3.0-or-later'
|
16
|
+
s.homepage = 'https://github.com/kalsan/anchormodel'
|
14
17
|
|
15
18
|
# Dependencies
|
16
|
-
s.add_runtime_dependency 'rails', '
|
19
|
+
s.add_runtime_dependency 'rails', '~> 7.0'
|
17
20
|
|
18
|
-
s.add_development_dependency '
|
19
|
-
s.add_development_dependency '
|
21
|
+
s.add_development_dependency 'rake', '~> 13.0.6'
|
22
|
+
s.add_development_dependency 'pry', '~> 0.14.1'
|
23
|
+
|
24
|
+
# Linter
|
25
|
+
s.add_development_dependency 'rubocop', '~> 1.43.0'
|
26
|
+
s.add_development_dependency 'rubocop-rails', '~> 2.17.4'
|
27
|
+
|
28
|
+
# Doc
|
29
|
+
s.add_development_dependency 'yard', '~> 0.9.28'
|
30
|
+
s.add_development_dependency 'yard-activesupport-concern', '~> 0.0.1'
|
31
|
+
|
32
|
+
# Test
|
33
|
+
s.add_development_dependency 'minitest', '~> 5.17.0'
|
34
|
+
s.add_development_dependency 'minitest-reporters', '~> 1.5.0'
|
35
|
+
s.add_development_dependency 'sqlite3', '~> 1.6.0'
|
20
36
|
end
|
21
37
|
|
22
38
|
File.open('anchormodel.gemspec', 'w') do |f|
|
@@ -25,3 +41,7 @@ task :gemspec do
|
|
25
41
|
f.write(specification.to_ruby.strip)
|
26
42
|
end
|
27
43
|
end
|
44
|
+
|
45
|
+
# Create "test" task
|
46
|
+
require 'minitest/test_task'
|
47
|
+
Minitest::TestTask.create
|
data/anchormodel.gemspec
CHANGED
@@ -2,17 +2,19 @@
|
|
2
2
|
# This file is auto-generated via: 'rake gemspec'.
|
3
3
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: anchormodel 0.0
|
5
|
+
# stub: anchormodel 0.1.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "anchormodel".freeze
|
9
|
-
s.version = "0.0
|
9
|
+
s.version = "0.1.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Sandro Kalbermatter".freeze]
|
14
|
-
s.date = "
|
15
|
-
s.files = [".gitignore".freeze, ".ruby-version".freeze, ".yardopts".freeze, "CHANGELOG.md".freeze, "
|
14
|
+
s.date = "2023-01-18"
|
15
|
+
s.files = [".gitignore".freeze, ".ruby-version".freeze, ".yardopts".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "Gemfile.lock".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "anchormodel.gemspec".freeze, "doc/Anchormodel.html".freeze, "doc/Anchormodel/ActiveModelTypeValue.html".freeze, "doc/Anchormodel/Attribute.html".freeze, "doc/Anchormodel/ModelMixin.html".freeze, "doc/Anchormodel/Version.html".freeze, "doc/_index.html".freeze, "doc/class_list.html".freeze, "doc/css/common.css".freeze, "doc/css/full_list.css".freeze, "doc/css/style.css".freeze, "doc/file.README.html".freeze, "doc/file_list.html".freeze, "doc/frames.html".freeze, "doc/index.html".freeze, "doc/js/app.js".freeze, "doc/js/full_list.js".freeze, "doc/js/jquery.js".freeze, "doc/method_list.html".freeze, "doc/top-level-namespace.html".freeze, "lib/anchormodel.rb".freeze, "lib/anchormodel/active_model_type_value.rb".freeze, "lib/anchormodel/attribute.rb".freeze, "lib/anchormodel/model_mixin.rb".freeze, "lib/anchormodel/version.rb".freeze, "logo.svg".freeze, "test/active_record_model/user_test.rb".freeze, "test/dummy/.gitignore".freeze, "test/dummy/Rakefile".freeze, "test/dummy/app/anchormodels/locale.rb".freeze, "test/dummy/app/anchormodels/role.rb".freeze, "test/dummy/app/helpers/application_helper.rb".freeze, "test/dummy/app/models/application_record.rb".freeze, "test/dummy/app/models/concerns/.keep".freeze, "test/dummy/app/models/user.rb".freeze, "test/dummy/bin/rails".freeze, "test/dummy/bin/rake".freeze, "test/dummy/bin/setup".freeze, "test/dummy/config.ru".freeze, "test/dummy/config/application.rb".freeze, "test/dummy/config/boot.rb".freeze, "test/dummy/config/credentials.yml.enc".freeze, "test/dummy/config/database.yml".freeze, "test/dummy/config/environment.rb".freeze, "test/dummy/config/environments/test.rb".freeze, "test/dummy/config/initializers/content_security_policy.rb".freeze, "test/dummy/config/initializers/filter_parameter_logging.rb".freeze, "test/dummy/config/initializers/inflections.rb".freeze, "test/dummy/config/initializers/permissions_policy.rb".freeze, "test/dummy/config/locales/en.yml".freeze, "test/dummy/config/puma.rb".freeze, "test/dummy/config/routes.rb".freeze, "test/dummy/db/migrate/20230107173151_create_users.rb".freeze, "test/dummy/db/schema.rb".freeze, "test/dummy/db/seeds.rb".freeze, "test/dummy/lib/tasks/.keep".freeze, "test/dummy/log/.keep".freeze, "test/dummy/tmp/.keep".freeze, "test/dummy/tmp/pids/.keep".freeze, "test/test_helper.rb".freeze]
|
16
|
+
s.homepage = "https://github.com/kalsan/anchormodel".freeze
|
17
|
+
s.licenses = ["LGPL-3.0-or-later".freeze]
|
16
18
|
s.required_ruby_version = Gem::Requirement.new(">= 3.0.0".freeze)
|
17
19
|
s.rubygems_version = "3.3.26".freeze
|
18
20
|
s.summary = "Bringing object-oriented programming to Rails enums".freeze
|
@@ -22,12 +24,26 @@ Gem::Specification.new do |s|
|
|
22
24
|
end
|
23
25
|
|
24
26
|
if s.respond_to? :add_runtime_dependency then
|
25
|
-
s.add_runtime_dependency(%q<rails>.freeze, ["
|
26
|
-
s.add_development_dependency(%q<
|
27
|
-
s.add_development_dependency(%q<
|
27
|
+
s.add_runtime_dependency(%q<rails>.freeze, ["~> 7.0"])
|
28
|
+
s.add_development_dependency(%q<rake>.freeze, ["~> 13.0.6"])
|
29
|
+
s.add_development_dependency(%q<pry>.freeze, ["~> 0.14.1"])
|
30
|
+
s.add_development_dependency(%q<rubocop>.freeze, ["~> 1.43.0"])
|
31
|
+
s.add_development_dependency(%q<rubocop-rails>.freeze, ["~> 2.17.4"])
|
32
|
+
s.add_development_dependency(%q<yard>.freeze, ["~> 0.9.28"])
|
33
|
+
s.add_development_dependency(%q<yard-activesupport-concern>.freeze, ["~> 0.0.1"])
|
34
|
+
s.add_development_dependency(%q<minitest>.freeze, ["~> 5.17.0"])
|
35
|
+
s.add_development_dependency(%q<minitest-reporters>.freeze, ["~> 1.5.0"])
|
36
|
+
s.add_development_dependency(%q<sqlite3>.freeze, ["~> 1.6.0"])
|
28
37
|
else
|
29
|
-
s.add_dependency(%q<rails>.freeze, ["
|
30
|
-
s.add_dependency(%q<
|
31
|
-
s.add_dependency(%q<
|
38
|
+
s.add_dependency(%q<rails>.freeze, ["~> 7.0"])
|
39
|
+
s.add_dependency(%q<rake>.freeze, ["~> 13.0.6"])
|
40
|
+
s.add_dependency(%q<pry>.freeze, ["~> 0.14.1"])
|
41
|
+
s.add_dependency(%q<rubocop>.freeze, ["~> 1.43.0"])
|
42
|
+
s.add_dependency(%q<rubocop-rails>.freeze, ["~> 2.17.4"])
|
43
|
+
s.add_dependency(%q<yard>.freeze, ["~> 0.9.28"])
|
44
|
+
s.add_dependency(%q<yard-activesupport-concern>.freeze, ["~> 0.0.1"])
|
45
|
+
s.add_dependency(%q<minitest>.freeze, ["~> 5.17.0"])
|
46
|
+
s.add_dependency(%q<minitest-reporters>.freeze, ["~> 1.5.0"])
|
47
|
+
s.add_dependency(%q<sqlite3>.freeze, ["~> 1.6.0"])
|
32
48
|
end
|
33
49
|
end
|
@@ -217,7 +217,8 @@
|
|
217
217
|
|
218
218
|
|
219
219
|
|
220
|
-
<span class="summary_desc"><div class='inline'
|
220
|
+
<span class="summary_desc"><div class='inline'>
|
221
|
+
<p>A new instance of ActiveModelTypeValue.</p>
|
221
222
|
</div></span>
|
222
223
|
|
223
224
|
</li>
|
@@ -240,7 +241,8 @@
|
|
240
241
|
|
241
242
|
|
242
243
|
|
243
|
-
<span class="summary_desc"><div class='inline'
|
244
|
+
<span class="summary_desc"><div class='inline'>
|
245
|
+
<p>Implementing this instead of cast to force key validation in any case.</p>
|
244
246
|
</div></span>
|
245
247
|
|
246
248
|
</li>
|
@@ -264,7 +266,8 @@
|
|
264
266
|
|
265
267
|
</h3><div class="docstring">
|
266
268
|
<div class="discussion">
|
267
|
-
|
269
|
+
|
270
|
+
<p>Returns a new instance of ActiveModelTypeValue.</p>
|
268
271
|
|
269
272
|
|
270
273
|
</div>
|
@@ -445,7 +448,8 @@
|
|
445
448
|
|
446
449
|
</h3><div class="docstring">
|
447
450
|
<div class="discussion">
|
448
|
-
|
451
|
+
|
452
|
+
<p>Implementing this instead of cast to force key validation in any case</p>
|
449
453
|
|
450
454
|
|
451
455
|
</div>
|
@@ -503,9 +507,9 @@
|
|
503
507
|
</div>
|
504
508
|
|
505
509
|
<div id="footer">
|
506
|
-
Generated on
|
510
|
+
Generated on Wed Jan 18 11:24:44 2023 by
|
507
511
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
508
|
-
0.9.28 (ruby-3.
|
512
|
+
0.9.28 (ruby-3.1.3).
|
509
513
|
</div>
|
510
514
|
|
511
515
|
</div>
|
@@ -101,8 +101,8 @@
|
|
101
101
|
|
102
102
|
<h2>Overview</h2><div class="docstring">
|
103
103
|
<div class="discussion">
|
104
|
-
|
105
|
-
It is instanciated when ModelMixin#belongs_to_anchormodel is used.</p>
|
104
|
+
|
105
|
+
<p>This class holds all information related to a Rails model pointing to an Anchormodel. It is instanciated when ModelMixin#belongs_to_anchormodel is used.</p>
|
106
106
|
|
107
107
|
|
108
108
|
</div>
|
@@ -201,7 +201,8 @@ It is instanciated when ModelMixin#belongs_to_anchormodel is used.</p>
|
|
201
201
|
|
202
202
|
|
203
203
|
|
204
|
-
<span class="summary_desc"><div class='inline'
|
204
|
+
<span class="summary_desc"><div class='inline'>
|
205
|
+
<p>Getter for the Anchormodel class based on the name passed to the initializer.</p>
|
205
206
|
</div></span>
|
206
207
|
|
207
208
|
</li>
|
@@ -226,7 +227,8 @@ It is instanciated when ModelMixin#belongs_to_anchormodel is used.</p>
|
|
226
227
|
|
227
228
|
|
228
229
|
|
229
|
-
<span class="summary_desc"><div class='inline'
|
230
|
+
<span class="summary_desc"><div class='inline'>
|
231
|
+
<p>A new instance of Attribute.</p>
|
230
232
|
</div></span>
|
231
233
|
|
232
234
|
</li>
|
@@ -249,7 +251,8 @@ It is instanciated when ModelMixin#belongs_to_anchormodel is used.</p>
|
|
249
251
|
|
250
252
|
</h3><div class="docstring">
|
251
253
|
<div class="discussion">
|
252
|
-
|
254
|
+
|
255
|
+
<p>Returns a new instance of Attribute.</p>
|
253
256
|
|
254
257
|
|
255
258
|
</div>
|
@@ -268,7 +271,8 @@ It is instanciated when ModelMixin#belongs_to_anchormodel is used.</p>
|
|
268
271
|
|
269
272
|
|
270
273
|
—
|
271
|
-
<div class='inline'
|
274
|
+
<div class='inline'>
|
275
|
+
<p>The Rails model where ModelMixin#belongs_to_anchormodel is used</p>
|
272
276
|
</div>
|
273
277
|
|
274
278
|
</li>
|
@@ -283,7 +287,8 @@ It is instanciated when ModelMixin#belongs_to_anchormodel is used.</p>
|
|
283
287
|
|
284
288
|
|
285
289
|
—
|
286
|
-
<div class='inline'
|
290
|
+
<div class='inline'>
|
291
|
+
<p>The name and database column of the attribute</p>
|
287
292
|
</div>
|
288
293
|
|
289
294
|
</li>
|
@@ -300,7 +305,8 @@ It is instanciated when ModelMixin#belongs_to_anchormodel is used.</p>
|
|
300
305
|
|
301
306
|
|
302
307
|
—
|
303
|
-
<div class='inline'
|
308
|
+
<div class='inline'>
|
309
|
+
<p>Name of the Anchormodel class (omit if attribute <code>:foo_bar</code> holds an <code>FooBar</code>)</p>
|
304
310
|
</div>
|
305
311
|
|
306
312
|
</li>
|
@@ -317,7 +323,8 @@ It is instanciated when ModelMixin#belongs_to_anchormodel is used.</p>
|
|
317
323
|
|
318
324
|
|
319
325
|
—
|
320
|
-
<div class='inline'
|
326
|
+
<div class='inline'>
|
327
|
+
<p>If true, a presence validation is added to the model.</p>
|
321
328
|
</div>
|
322
329
|
|
323
330
|
</li>
|
@@ -344,7 +351,7 @@ It is instanciated when ModelMixin#belongs_to_anchormodel is used.</p>
|
|
344
351
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_model_class'>model_class</span><span class='comma'>,</span> <span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='comma'>,</span> <span class='id identifier rubyid_anchor_class_name'>anchor_class_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_optional'>optional</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
345
352
|
<span class='ivar'>@model_class</span> <span class='op'>=</span> <span class='id identifier rubyid_model_class'>model_class</span>
|
346
353
|
<span class='ivar'>@attribute_name</span> <span class='op'>=</span> <span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
347
|
-
<span class='ivar'>@anchor_class_name</span> <span class='op'>=</span> <span class='id identifier rubyid_anchor_class_name'>anchor_class_name</span> <span class='op'>||</span> <span class='
|
354
|
+
<span class='ivar'>@anchor_class_name</span> <span class='op'>=</span> <span class='id identifier rubyid_anchor_class_name'>anchor_class_name</span> <span class='op'>||</span> <span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_classify'>classify</span>
|
348
355
|
<span class='ivar'>@optional</span> <span class='op'>=</span> <span class='id identifier rubyid_optional'>optional</span>
|
349
356
|
<span class='kw'>end</span></pre>
|
350
357
|
</td>
|
@@ -457,8 +464,8 @@ It is instanciated when ModelMixin#belongs_to_anchormodel is used.</p>
|
|
457
464
|
|
458
465
|
</h3><div class="docstring">
|
459
466
|
<div class="discussion">
|
460
|
-
|
461
|
-
We are loading the anchor class lazily, because the model mixin instanciates this statically -> avoid premature anchor class loading</p>
|
467
|
+
|
468
|
+
<p>Getter for the Anchormodel class based on the name passed to the initializer. We are loading the anchor class lazily, because the model mixin instanciates this statically -> avoid premature anchor class loading</p>
|
462
469
|
|
463
470
|
|
464
471
|
</div>
|
@@ -492,9 +499,9 @@ We are loading the anchor class lazily, because the model mixin instanciates thi
|
|
492
499
|
</div>
|
493
500
|
|
494
501
|
<div id="footer">
|
495
|
-
Generated on
|
502
|
+
Generated on Wed Jan 18 11:24:43 2023 by
|
496
503
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
497
|
-
0.9.28 (ruby-3.
|
504
|
+
0.9.28 (ruby-3.1.3).
|
498
505
|
</div>
|
499
506
|
|
500
507
|
</div>
|
@@ -90,7 +90,8 @@
|
|
90
90
|
|
91
91
|
<h2>Overview</h2><div class="docstring">
|
92
92
|
<div class="discussion">
|
93
|
-
|
93
|
+
|
94
|
+
<p>All Rails models making use of #belongs_to_anchormodel must include this mixin. Typically, it is included in <code>application_record.rb</code>.</p>
|
94
95
|
|
95
96
|
|
96
97
|
</div>
|
@@ -130,7 +131,8 @@
|
|
130
131
|
|
131
132
|
|
132
133
|
|
133
|
-
<span class="summary_desc"><div class='inline'
|
134
|
+
<span class="summary_desc"><div class='inline'>
|
135
|
+
<p>Creates an attribute linking to an Anchormodel.</p>
|
134
136
|
</div></span>
|
135
137
|
|
136
138
|
</li>
|
@@ -157,8 +159,8 @@
|
|
157
159
|
|
158
160
|
</h3><div class="docstring">
|
159
161
|
<div class="discussion">
|
160
|
-
|
161
|
-
present in the DB and the column should be named the same as <code>attribute_name.</code></p>
|
162
|
+
|
163
|
+
<p>Creates an attribute linking to an Anchormodel. The attribute should be present in the DB and the column should be named the same as <code>attribute_name.</code></p>
|
162
164
|
|
163
165
|
|
164
166
|
</div>
|
@@ -177,7 +179,8 @@ present in the DB and the column should be named the same as <code>attribute_nam
|
|
177
179
|
|
178
180
|
|
179
181
|
—
|
180
|
-
<div class='inline'
|
182
|
+
<div class='inline'>
|
183
|
+
<p>The name and database column of the attribute</p>
|
181
184
|
</div>
|
182
185
|
|
183
186
|
</li>
|
@@ -194,7 +197,8 @@ present in the DB and the column should be named the same as <code>attribute_nam
|
|
194
197
|
|
195
198
|
|
196
199
|
—
|
197
|
-
<div class='inline'
|
200
|
+
<div class='inline'>
|
201
|
+
<p>Name of the Anchormodel class (omit if attribute <code>:foo_bar</code> holds a <code>FooBar</code>)</p>
|
198
202
|
</div>
|
199
203
|
|
200
204
|
</li>
|
@@ -211,7 +215,8 @@ present in the DB and the column should be named the same as <code>attribute_nam
|
|
211
215
|
|
212
216
|
|
213
217
|
—
|
214
|
-
<div class='inline'
|
218
|
+
<div class='inline'>
|
219
|
+
<p>If true, a presence validation is added to the model.</p>
|
215
220
|
</div>
|
216
221
|
|
217
222
|
</li>
|
@@ -297,9 +302,9 @@ present in the DB and the column should be named the same as <code>attribute_nam
|
|
297
302
|
</div>
|
298
303
|
|
299
304
|
<div id="footer">
|
300
|
-
Generated on
|
305
|
+
Generated on Wed Jan 18 11:24:43 2023 by
|
301
306
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
302
|
-
0.9.28 (ruby-3.
|
307
|
+
0.9.28 (ruby-3.1.3).
|
303
308
|
</div>
|
304
309
|
|
305
310
|
</div>
|
@@ -141,7 +141,7 @@
|
|
141
141
|
|
142
142
|
</div>
|
143
143
|
</dt>
|
144
|
-
<dd><pre class="code"><span class='int'>
|
144
|
+
<dd><pre class="code"><span class='int'>3</span></pre></dd>
|
145
145
|
|
146
146
|
<dt id="EDGE-constant" class="">EDGE =
|
147
147
|
<div class="docstring">
|
@@ -185,9 +185,9 @@
|
|
185
185
|
</div>
|
186
186
|
|
187
187
|
<div id="footer">
|
188
|
-
Generated on
|
188
|
+
Generated on Wed Jan 18 11:24:43 2023 by
|
189
189
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
190
|
-
0.9.28 (ruby-3.
|
190
|
+
0.9.28 (ruby-3.1.3).
|
191
191
|
</div>
|
192
192
|
|
193
193
|
</div>
|