repository-base 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +27 -0
  5. data/.travis.yml +6 -0
  6. data/.yardopts +1 -0
  7. data/CHANGELOG.md +128 -0
  8. data/Gemfile +4 -0
  9. data/LICENSE +22 -0
  10. data/README.md +132 -0
  11. data/Rakefile +33 -0
  12. data/bin/bundle +105 -0
  13. data/bin/htmldiff +29 -0
  14. data/bin/kramdown +29 -0
  15. data/bin/ldiff +29 -0
  16. data/bin/rake +29 -0
  17. data/bin/rspec +29 -0
  18. data/bin/rubocop +29 -0
  19. data/bin/ruby-parse +29 -0
  20. data/bin/ruby-rewrite +29 -0
  21. data/bin/setup +43 -0
  22. data/bin/yard +29 -0
  23. data/bin/yardoc +29 -0
  24. data/bin/yri +29 -0
  25. data/doc/Repository.html +128 -0
  26. data/doc/Repository/Base.html +1248 -0
  27. data/doc/Repository/Base/Internals.html +133 -0
  28. data/doc/Repository/Base/Internals/RecordDeleter.html +687 -0
  29. data/doc/Repository/Base/Internals/RecordSaver.html +816 -0
  30. data/doc/Repository/Base/Internals/RecordUpdater.html +1026 -0
  31. data/doc/Repository/Base/Internals/SlugFinder.html +986 -0
  32. data/doc/_index.html +176 -0
  33. data/doc/class_list.html +51 -0
  34. data/doc/css/common.css +1 -0
  35. data/doc/css/full_list.css +58 -0
  36. data/doc/css/style.css +499 -0
  37. data/doc/file.CHANGELOG.html +240 -0
  38. data/doc/file.README.html +218 -0
  39. data/doc/file_list.html +61 -0
  40. data/doc/frames.html +17 -0
  41. data/doc/index.html +218 -0
  42. data/doc/js/app.js +248 -0
  43. data/doc/js/full_list.js +216 -0
  44. data/doc/js/jquery.js +4 -0
  45. data/doc/method_list.html +363 -0
  46. data/doc/top-level-namespace.html +110 -0
  47. data/lib/repository/base.rb +115 -0
  48. data/lib/repository/base/internals/internals.rb +6 -0
  49. data/lib/repository/base/internals/record_deleter.rb +46 -0
  50. data/lib/repository/base/internals/record_saver.rb +58 -0
  51. data/lib/repository/base/internals/record_updater.rb +54 -0
  52. data/lib/repository/base/internals/slug_finder.rb +70 -0
  53. data/lib/repository/base/version.rb +12 -0
  54. data/repository-base.gemspec +37 -0
  55. data/spec/repository/base_spec.rb +398 -0
  56. data/spec/spec_helper.rb +14 -0
  57. metadata +281 -0
@@ -0,0 +1,240 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ File: CHANGELOG
8
+
9
+ &mdash; Documentation by YARD 0.9.12
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "CHANGELOG";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="file_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index</a> &raquo;
40
+ <span class="title">File: CHANGELOG</span>
41
+
42
+ </div>
43
+
44
+ <div id="search">
45
+
46
+ <a class="full_list_link" id="class_list_link"
47
+ href="class_list.html">
48
+
49
+ <svg width="24" height="24">
50
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
51
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
52
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
53
+ </svg>
54
+ </a>
55
+
56
+ </div>
57
+ <div class="clear"></div>
58
+ </div>
59
+
60
+ <div id="content"><div id='filecontents'><h1 id="change-log">Change Log</h1>
61
+
62
+ <h2 id="v040httpsgithubcomjdickeyrepository-basetreev030-2018-02-03"><a href="https://github.com/jdickey/repository-base/tree/v0.3.0">v0.4.0</a> (2018-02-03)</h2>
63
+
64
+ <p><a href="https://github.com/jdickey/repository-base/compare/v0.2.0...v0.3.0">Full Changelog</a></p>
65
+
66
+ <ul>
67
+ <li>Added <a href="./doc/index.html">YARD-generated documentation</a></li>
68
+ <li>Updated Ruby version to 2.5.0;</li>
69
+ <li>Updated developer dependencies to now-current versions;</li>
70
+ <li>Made trivial code changes to satisfy static-analysis tools. Tests still green.</li>
71
+ </ul>
72
+
73
+ <h2 id="v030httpsgithubcomjdickeyrepository-basetreev030-2015-03-30"><a href="https://github.com/jdickey/repository-base/tree/v0.3.0">v0.3.0</a> (2015-03-30)</h2>
74
+
75
+ <p><a href="https://github.com/jdickey/repository-base/compare/v0.2.0...v0.3.0">Full Changelog</a></p>
76
+
77
+ <p><strong>Fixed bugs:</strong></p>
78
+
79
+ <ul>
80
+ <li>Adding an entity? Its attributes may not always be a Hash. <a href="https://github.com/jdickey/repository-base/issues/19">#19</a></li>
81
+ </ul>
82
+
83
+ <p><strong>Merged pull requests:</strong></p>
84
+
85
+ <ul>
86
+ <li>Support entity attributes conversion. Also, merge fixed Travis into master. <a href="https://github.com/jdickey/repository-base/pull/20">#20</a> (<a href="https://github.com/jdickey">jdickey</a>)</li>
87
+ </ul>
88
+
89
+ <h2 id="v020httpsgithubcomjdickeyrepository-basetreev020-2015-02-22"><a href="https://github.com/jdickey/repository-base/tree/v0.2.0">v0.2.0</a> (2015-02-22)</h2>
90
+
91
+ <p><a href="https://github.com/jdickey/repository-base/compare/v0.1.2...v0.2.0">Full Changelog</a></p>
92
+
93
+ <p><strong>Fixed bugs:</strong></p>
94
+
95
+ <ul>
96
+ <li>Public methods should return entities, not DAO records. <a href="https://github.com/jdickey/repository-base/issues/18">#18</a></li>
97
+ </ul>
98
+
99
+ <h2 id="v012httpsgithubcomjdickeyrepository-basetreev012-2015-02-20"><a href="https://github.com/jdickey/repository-base/tree/v0.1.2">v0.1.2</a> (2015-02-20)</h2>
100
+
101
+ <p><a href="https://github.com/jdickey/repository-base/compare/v0.1.1...v0.1.2">Full Changelog</a></p>
102
+
103
+ <p><strong>Fixed bugs:</strong></p>
104
+
105
+ <ul>
106
+ <li>The #update method should return an entity, not a record. <a href="https://github.com/jdickey/repository-base/issues/17">#17</a></li>
107
+ </ul>
108
+
109
+ <h2 id="v011httpsgithubcomjdickeyrepository-basetreev011-2015-02-19"><a href="https://github.com/jdickey/repository-base/tree/v0.1.1">v0.1.1</a> (2015-02-19)</h2>
110
+
111
+ <p><a href="https://github.com/jdickey/repository-base/compare/v0.1.0...v0.1.1">Full Changelog</a></p>
112
+
113
+ <p><strong>Implemented enhancements:</strong></p>
114
+
115
+ <ul>
116
+ <li>Add Inch badge (and prodded docs). <a href="https://github.com/jdickey/repository-base/issues/14">#14</a></li>
117
+ </ul>
118
+
119
+ <p><strong>Fixed bugs:</strong></p>
120
+
121
+ <ul>
122
+ <li>The <code>\#add</code> method should return an entity on success, NOT a record. <a href="https://github.com/jdickey/repository-base/issues/16">#16</a></li>
123
+ </ul>
124
+
125
+ <p><strong>Merged pull requests:</strong></p>
126
+
127
+ <ul>
128
+ <li>[Close #14] Added Inch CI badge and internal docs. <a href="https://github.com/jdickey/repository-base/pull/15">#15</a> (<a href="https://github.com/jdickey">jdickey</a>)</li>
129
+ </ul>
130
+
131
+ <h2 id="v010httpsgithubcomjdickeyrepository-basetreev010-2015-02-18"><a href="https://github.com/jdickey/repository-base/tree/v0.1.0">v0.1.0</a> (2015-02-18)</h2>
132
+
133
+ <p><a href="https://github.com/jdickey/repository-base/compare/v0.0.5...v0.1.0">Full Changelog</a></p>
134
+
135
+ <p><strong>Closed issues:</strong></p>
136
+
137
+ <ul>
138
+ <li>Integrate <code>repository-support</code> Gem in place of <code>lib/repository/support/\*</code> sources. <a href="https://github.com/jdickey/repository-base/issues/13">#13</a></li>
139
+ </ul>
140
+
141
+ <h2 id="v005httpsgithubcomjdickeyrepository-basetreev005-2015-02-17"><a href="https://github.com/jdickey/repository-base/tree/v0.0.5">v0.0.5</a> (2015-02-17)</h2>
142
+
143
+ <p><a href="https://github.com/jdickey/repository-base/compare/v0.0.4...v0.0.5">Full Changelog</a></p>
144
+
145
+ <p><strong>Closed issues:</strong></p>
146
+
147
+ <ul>
148
+ <li>Implement #delete method. <a href="https://github.com/jdickey/repository-base/issues/11">#11</a></li>
149
+ </ul>
150
+
151
+ <p><strong>Merged pull requests:</strong></p>
152
+
153
+ <ul>
154
+ <li>Implement #delete method. <a href="https://github.com/jdickey/repository-base/pull/12">#12</a> (<a href="https://github.com/jdickey">jdickey</a>)</li>
155
+ </ul>
156
+
157
+ <h2 id="v004httpsgithubcomjdickeyrepository-basetreev004-2015-02-17"><a href="https://github.com/jdickey/repository-base/tree/v0.0.4">v0.0.4</a> (2015-02-17)</h2>
158
+
159
+ <p><a href="https://github.com/jdickey/repository-base/compare/v0.0.3...v0.0.4">Full Changelog</a></p>
160
+
161
+ <p><strong>Closed issues:</strong></p>
162
+
163
+ <ul>
164
+ <li>Implement #update method. <a href="https://github.com/jdickey/repository-base/issues/9">#9</a></li>
165
+ </ul>
166
+
167
+ <p><strong>Merged pull requests:</strong></p>
168
+
169
+ <ul>
170
+ <li>Implement #update method. <a href="https://github.com/jdickey/repository-base/pull/10">#10</a> (<a href="https://github.com/jdickey">jdickey</a>)</li>
171
+ </ul>
172
+
173
+ <h2 id="v003httpsgithubcomjdickeyrepository-basetreev003-2015-02-17"><a href="https://github.com/jdickey/repository-base/tree/v0.0.3">v0.0.3</a> (2015-02-17)</h2>
174
+
175
+ <p><a href="https://github.com/jdickey/repository-base/compare/v0.0.2...v0.0.3">Full Changelog</a></p>
176
+
177
+ <p><strong>Closed issues:</strong></p>
178
+
179
+ <ul>
180
+ <li>Implement #find_by_slug method. <a href="https://github.com/jdickey/repository-base/issues/7">#7</a></li>
181
+ </ul>
182
+
183
+ <p><strong>Merged pull requests:</strong></p>
184
+
185
+ <ul>
186
+ <li>Implement <code>\#find\_by\_slug</code> method. <a href="https://github.com/jdickey/repository-base/pull/8">#8</a> (<a href="https://github.com/jdickey">jdickey</a>)</li>
187
+ </ul>
188
+
189
+ <h2 id="v002httpsgithubcomjdickeyrepository-basetreev002-2015-02-16"><a href="https://github.com/jdickey/repository-base/tree/v0.0.2">v0.0.2</a> (2015-02-16)</h2>
190
+
191
+ <p><a href="https://github.com/jdickey/repository-base/compare/v0.0.1...v0.0.2">Full Changelog</a></p>
192
+
193
+ <p><strong>Closed issues:</strong></p>
194
+
195
+ <ul>
196
+ <li>
197
+ <p>Implement #all method. <a href="https://github.com/jdickey/repository-base/issues/5">#5</a></p>
198
+ </li>
199
+ <li>
200
+ <p>Badges! <a href="https://github.com/jdickey/repository-base/issues/2">#2</a></p>
201
+ </li>
202
+ </ul>
203
+
204
+ <p><strong>Merged pull requests:</strong></p>
205
+
206
+ <ul>
207
+ <li>Implement #all method. <a href="https://github.com/jdickey/repository-base/pull/6">#6</a> (<a href="https://github.com/jdickey">jdickey</a>)</li>
208
+ </ul>
209
+
210
+ <h2 id="v001httpsgithubcomjdickeyrepository-basetreev001-2015-02-16"><a href="https://github.com/jdickey/repository-base/tree/v0.0.1">v0.0.1</a> (2015-02-16)</h2>
211
+
212
+ <p><strong>Closed issues:</strong></p>
213
+
214
+ <ul>
215
+ <li>Implement #add method <a href="https://github.com/jdickey/repository-base/issues/3">#3</a></li>
216
+ </ul>
217
+
218
+ <p><strong>Merged pull requests:</strong></p>
219
+
220
+ <ul>
221
+ <li>
222
+ <p>[Close #3] Implement <code>\#add</code> method. <a href="https://github.com/jdickey/repository-base/pull/4">#4</a> (<a href="https://github.com/jdickey">jdickey</a>)</p>
223
+ </li>
224
+ <li>
225
+ <p>Add a Gitter chat badge to README.md <a href="https://github.com/jdickey/repository-base/pull/1">#1</a> (<a href="https://github.com/gitter-badger">gitter-badger</a>)</p>
226
+ </li>
227
+ </ul>
228
+
229
+ <p>* <em>This Change Log was automatically generated by <a href="https://github.com/skywinder/Github-Changelog-Generator">github_changelog_generator</a></em></p>
230
+ </div></div>
231
+
232
+ <div id="footer">
233
+ Generated on Sat Feb 3 03:00:17 2018 by
234
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
235
+ 0.9.12 (ruby-2.5.0).
236
+ </div>
237
+
238
+ </div>
239
+ </body>
240
+ </html>
@@ -0,0 +1,218 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ File: README
8
+
9
+ &mdash; Documentation by YARD 0.9.12
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "README";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="file_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index</a> &raquo;
40
+ <span class="title">File: README</span>
41
+
42
+ </div>
43
+
44
+ <div id="search">
45
+
46
+ <a class="full_list_link" id="class_list_link"
47
+ href="class_list.html">
48
+
49
+ <svg width="24" height="24">
50
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
51
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
52
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
53
+ </svg>
54
+ </a>
55
+
56
+ </div>
57
+ <div class="clear"></div>
58
+ </div>
59
+
60
+ <div id="content"><div id='filecontents'><h1>Repository::Base</h1>
61
+
62
+ <p><a href="https://gitter.im/jdickey/repository-base?utm_source=badge&amp;utm_medium=badge&amp;utm_campaign=pr-badge&amp;utm_content=badge"><img src="https://badges.gitter.im/Join%20Chat.svg" alt="Join the chat at https://gitter.im/jdickey/repository-base" /></a>
63
+ <a href="http://badge.fury.io/rb/repository-base"><img src="https://badge.fury.io/rb/repository-base.svg" alt="Gem Version" /></a>
64
+ <a href="https://codeclimate.com/github/jdickey/repository-base"><img src="https://codeclimate.com/github/jdickey/repository-base.png" alt="Code Climate" /></a>
65
+ <a href="https://codeship.com/projects/63061"> <img src="https://codeship.com/projects/ae57fed0-969f-0132-1faa-76c54edd661d/status?branch=master" alt="Codeship Status for jdickey/repository-base" /></a>
66
+ <a href="https://hakiri.io/github/jdickey/repository-base/master"><img src="https://hakiri.io/github/jdickey/repository-base/master.svg" alt="security" /></a>
67
+ <a href="https://gemnasium.com/jdickey/repository-base"><img src="https://gemnasium.com/jdickey/repository-base.svg" alt="Dependency Status" /></a>
68
+ <a href="http://inch-ci.org/github/jdickey/repository-base"><img src="http://inch-ci.org/github/jdickey/repository-base.svg?style=shields" alt="Inline docs" /></a></p>
69
+
70
+ <p>This Gem supplies a class, <code>Repository::Base</code>, which can be used as a base class
71
+ for Repositories in an application that uses the
72
+ <a href="http://martinfowler.com/eaaCatalog/dataMapper.html">Data Mapper pattern</a>.
73
+ As described by Fowler, Data Mapper “moves data between objects and a database
74
+ while keeping them independent of each other and the mapper itself”.</p>
75
+
76
+ <p>This was originally developed within the structure of an R&amp;D test-bed application,
77
+ <a href="https://github.com/jdickey/new_poc"><code>new_poc</code></a>. That app has a fairly wide-ranging
78
+ history; after browsing its README and
79
+ <a href="https://github.com/jdickey/new_poc/commits">commit history</a>, you may find Pull
80
+ Requests <a href="https://github.com/jdickey/new_poc/pull/153">#153</a> and
81
+ <a href="https://github.com/jdickey/new_poc/pull/153">#200</a> informative as to the
82
+ historical basis of this code.</p>
83
+
84
+ <h2>Contents</h2>
85
+
86
+ <ul>
87
+ <li><a href="#installation">Installation</a></li>
88
+ <li><a href="#usage">Usage</a>
89
+ <ul>
90
+ <li><a href="#important-legacy-notice">IMPORTANT LEGACY NOTICE</a></li>
91
+ <li><a href="#concepts">Concepts</a>
92
+ <ul>
93
+ <li><a href="#entities">Entities</a></li>
94
+ <li><a href="#entity-factories">Entity Factories</a></li>
95
+ <li><a href="#storeresult">StoreResult</a></li>
96
+ <li><a href="#repositorybase-instance-methods"><code>Repository::Base</code> Instance Methods</a></li>
97
+ </ul>
98
+ </li>
99
+ <li><a href="#more-details">More Details</a></li>
100
+ </ul>
101
+ </li>
102
+ <li><a href="#contributing">Contributing</a></li>
103
+ </ul>
104
+
105
+ <h2 id="installation">Installation</h2>
106
+
107
+ <p>Add this line to your application’s Gemfile:</p>
108
+
109
+ <p><code>ruby
110
+ gem 'repository-base'
111
+ </code></p>
112
+
113
+ <p>And then execute:</p>
114
+
115
+ <pre class="code ruby"><code class="ruby">$ bundle
116
+ </code></pre>
117
+
118
+ <p>Or install it yourself as:</p>
119
+
120
+ <pre class="code ruby"><code class="ruby">$ gem install repository-base
121
+ </code></pre>
122
+
123
+ <h2 id="usage">Usage</h2>
124
+
125
+ <h3 id="important-legacy-notice">IMPORTANT LEGACY NOTICE</h3>
126
+
127
+ <p><strong><em>NOTICE!</em></strong> This Gem was created to support a solo, ad-hoc, early learning experience in what is now known as Clean Architecture. It was part of our first attempt to build an alternative to the ActiveRecord/ActiveModel scheme native to Ruby on Rails.</p>
128
+
129
+ <p>As such, it has been superseded and far outshone by other, team efforts, notably <a href="http://rom-rb.org/">ROM</a> as used with <a href="http://hanamirb.org/">Hanami</a> and <a href="http://trailblazer.to/">Trailblazer</a>. You are <em>strongly advised</em> to examine these and other tools rather than to use this for <em>any</em> new development. The Gem is being republished as an 0.4.0 release purely for internal archaeological purposes.</p>
130
+
131
+ <h3 id="concepts">Concepts</h3>
132
+
133
+ <p>As mentioned at the top of this file, <code>Repository::Base</code> is intended to serve as
134
+ the base class for your app’s Repositories. As with most Data Mapper
135
+ implementations, it makes use of a database access object, or DAO, which you
136
+ specify as one of the two parameters to <code>#initialize</code>. The other parameter is an
137
+ “entity factory”, whose <code>.create</code> class method hands back an “entity” reflecting
138
+ the content of an individual record in the underlying DAO.</p>
139
+
140
+ <h4 id="entities">Entities</h4>
141
+
142
+ <p>What is an “entity”? It’s a domain object in your application, with methods
143
+ expressing the business logic applicable to the object represented by the underlying
144
+ database record. This is distinct from an ActiveRecord-style <em>model</em>, in that
145
+ more than one variation of entity may exist in your application for a given DAO.
146
+ Most applications have Users, for example; some applications may have distinct
147
+ variation of User <em>entities</em> (ordinary punters, admins, a “guest user” entity
148
+ representing a user who has not authenticated as a more-privileged user, etc),
149
+ that all share a common persistence layer (the underlying DAO) and an entity
150
+ factory that <em>knows</em> how to create the correct type of entity for a given DAO
151
+ record.</p>
152
+
153
+ <p>An entity is uniquely identified by a <em>slug</em> rather than a numeric ID. Generally,
154
+ a slug encodes textual, relatively SEO-friendly information corresponding to an
155
+ individual record (the title of an article, the name of a user, etc) such that
156
+ the corresponding record may be uniquely identified by the DAO. This is in
157
+ preference to a “traditional” numeric record ID number; <code>Repository::Base</code> has
158
+ no knowledge of nor direct support for numeric record IDs.</p>
159
+
160
+ <h4 id="entity-factories">Entity Factories</h4>
161
+
162
+ <p>Again, the entity factory, one of the parameters to this class’ <code>#initialize</code>
163
+ method, is responsible for creating an entity from a DAO instance (record). The
164
+ <code>Repository::Base</code> class knows nothing of the details of how that is done; it
165
+ simply calls methods on the DAO and/or entity factory to accomplish the tasks
166
+ encapsulated by its own individual methods.</p>
167
+
168
+ <h4 id="storeresult">StoreResult</h4>
169
+
170
+ <p>What is a <code>StoreResult</code>? It is a simple value object which communicates the
171
+ result of a call to a method on the underlying DAO <em>as reported by the DAO</em>,
172
+ with the following properties:</p>
173
+
174
+ <ul>
175
+ <li><code>success?</code> (accessible as <code>result.success?</code> or as <code>result[:success?]</code>), has the value <code>true</code> after a successful operation or <code>false</code> after an unsuccessful one;</li>
176
+ <li><code>entity</code> (<code>result.entity</code> or <code>result[:entity]</code>) is the instance or enumeration of instances of your domain entity resulting from a successful operation. After an unsuccessful operation, this property will be <code>nil</code>;</li>
177
+ <li><code>errors</code> (<code>result.errors</code> or <code>result[:errors]</code>) is an Array-like object which is empty after a successful operation. After an unsuccessful operation, it will contain an Array of Hash instances, with each Hash having a key identifying the field or similar concept for which an individual error is being reported, and a value of the specific error message. For example, to report that a <code>:name</code> field was empty or blank, you might have a Hash of `{ name: ‘is empty or blank’ }. Your application domain logic should then understand how to deal with that convention.</li>
178
+ </ul>
179
+
180
+ <h4 id="repositorybase-instance-methods"><code>Repository::Base</code> Instance Methods</h4>
181
+
182
+ <ul>
183
+ <li><code>#add</code> adds a new record to the underlying <em>DAO</em> (data-access object; see above) using the field values specified by the <em>entity</em> passed as the only parameter. Returns a <code>StoreResult</code> (see above) which indicates the success or failure of the operation. On success, the <code>StoreResult</code> contains a <em>new</em> entity that represents the state of the record added to the underlying DAO;</li>
184
+ <li><code>#all</code> returns a collection of entities matching all records as reported by the underlying DAO, with entities created by the appropriate entity factory;</li>
185
+ <li><code>#delete</code> instructs the DAO to delete the record corresponding to the specified <code>slug</code>. Returns a <code>StoreResult</code> with an entity corresponding to the deleted record on success, or with appropriate error message(s) on failure;</li>
186
+ <li><code>#find_by_slug</code> instructs the DAO to retrieve the record whose unique slug value matches the supplied parameter. On success, returns a <code>StoreResult</code> with an entity corresponding to the selected record; on failure, the <code>StoreResult</code> has an <code>entity</code> value of <code>nil</code> and appropriate error messages in <code>errors</code>;</li>
187
+ <li><code>update</code> causes the DAO to attempt to update the record identified by the passed-in slug using the passed-in field values. On success, returns a <code>StoreResult</code> whose <code>entity</code> value mirrors the updated DAO record; on failure, has appropriate error indications in the <code>StoreResult</code>’s <code>errors</code> property.</li>
188
+ </ul>
189
+
190
+ <h3 id="more-details">More Details</h3>
191
+
192
+ <p>This Gem now has <a href="./doc/index.html">full documentation available</a>. (No, this isn’t 1990s-era <code>rdoc</code>.)</p>
193
+
194
+ <p>This Gem was built with <strong>MRI Ruby 2.5.0</strong>. It <strong>is likely to</strong> work when rebuilt with any version after 2.0.0; however, as it makes use of <a href="http://ruby-doc.org//core-2.1.0/doc/syntax/methods_rdoc.html#label-Keyword+Arguments">keyword arguments</a> for various methods, it is <em>incompatible</em> with Ruby 1.9 or earlier.</p>
195
+
196
+ <h2 id="contributing">Contributing</h2>
197
+
198
+ <ol>
199
+ <li>Fork it ( https://github.com/jdickey/repository-base/fork )</li>
200
+ <li>Create your feature branch (<code>git checkout -b my-new-feature</code>)</li>
201
+ <li>Ensure that your changes are completely covered by <em>passing</em> specs, and comply with the <a href="https://github.com/bbatsov/ruby-style-guide">Ruby Style Guide</a> as enforced by <a href="https://github.com/bbatsov/rubocop">RuboCop</a>. To verify this, run <code>bundle exec rake</code>, noting and repairing any lapses in coverage or style violations;</li>
202
+ <li>Commit your changes (<code>git commit -a</code>). Please <em>do not</em> use a single-line commit message (<code>git commit -am "some message"</code>). A good commit message notes what was changed and why in sufficient detail that a relative newcomer to the code can understand your reasoning and your code;</li>
203
+ <li>Push to the branch (<code>git push origin my-new-feature</code>)</li>
204
+ <li>Create a new Pull Request. Describe at some length the rationale for your new feature; your implementation strategy at a higher level than each individual commit message; anything future maintainers should be aware of; and so on. <em>If this is a modification to existing code, reference the open issue being addressed</em>.</li>
205
+ <li>Don’t be discouraged if the PR generates a discussion that leads to further refinement of your PR through additional commits. These should <em>generally</em> be discussed in comments on the PR itself; discussion in the Gitter room (see below) may also be useful;</li>
206
+ <li>If you’ve comments, questions, or just want to talk through your ideas, don’t hesitate to hang out in the project’s <a href="https://gitter.im/jdickey/repository-base">room on Gitter</a>. Ask away!</li>
207
+ </ol>
208
+ </div></div>
209
+
210
+ <div id="footer">
211
+ Generated on Sat Feb 3 03:00:17 2018 by
212
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
213
+ 0.9.12 (ruby-2.5.0).
214
+ </div>
215
+
216
+ </div>
217
+ </body>
218
+ </html>