anonymous_active_record 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 122443ea21e04dc844dfc547f12dacc18fa889ebf91b988b580f5c32cd63f547
4
- data.tar.gz: 9948435b6b32dd03ad00ff89c1f0740da2ae5f74ebd3b87a2851e48f94ee59d8
3
+ metadata.gz: 88f0a087ea06c2f95b0dc073bdc82320be8dff7a3c716dc0032e64b21b95d211
4
+ data.tar.gz: baec44efc3b5f547f546f586b3ff0b9c6f6e27a05403f4db6caaacff01da9728
5
5
  SHA512:
6
- metadata.gz: fd9b89d81ed386ee4e5b988d127bd266bcd546d3c1f5f242da5f2ea4af14be5a5dc307125a87859ee7066033db0c804d4d76f44871f9819167ff2d8eb688e414
7
- data.tar.gz: 53f79696142eb5df7bb52470a651caafe1c98170ffe849f324861b17601eeb564ef7764488af91bb430222c9b3579779158564eeb0835a20017b3f7024f6790b
6
+ metadata.gz: a4ba575163b07e62f31cf833aadcc44fd7ed953714aaeef1153aae0c184a927dcafbfafa976c219850b8bafd523e91a2be6308a17cd0d150826621062f57b904
7
+ data.tar.gz: 44ded816af7df8db18e32d8e793d06702e5ad922c73b5475350e7d9ec049c230d91bdeac38bebe7c0ff29f4802a375334d3db1870db183717333c4dd846dab8d
checksums.yaml.gz.sig ADDED
Binary file
data/CHANGELOG.md ADDED
@@ -0,0 +1,71 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file,
4
+ starting with version 1.0.9.
5
+
6
+ The format is based on [Keep a Changelog v1](https://keepachangelog.com/en/1.0.0/),
7
+ and this project adheres to [Semantic Versioning v2](https://semver.org/spec/v2.0.0.html).
8
+
9
+ ## [Unreleased]
10
+ ### Added
11
+ ### Changed
12
+ ### Fixed
13
+ ### Removed
14
+
15
+ ## [1.0.9] 2024.SEP.18
16
+ COVERAGE: 100.00% -- 82/82 lines in 4 files
17
+ BRANCH COVERAGE: 94.44% -- 17/18 branches in 4 files
18
+ 59.09% documented
19
+ ### Added
20
+ - 100% test coverage
21
+ - Expanded CI test matrix to cover all supported & unsupported Rubies
22
+ - Ruby 2.4
23
+ - Ruby 2.5
24
+ - Ruby 2.6
25
+ - Ruby 2.7
26
+ - Ruby 3.0
27
+ - Ruby 3.1
28
+ - Ruby 3.2
29
+ - Ruby 3.3
30
+ - ruby-head
31
+ - truffleruby-head
32
+ - Improved Documentation
33
+ - `kettle-soup-cover` for test coverage enforcement
34
+ - `kettle-soup-cover` for test coverage enforcement
35
+ - `bin/checksums` for release checksums
36
+ - Checksums for release
37
+ - SHA-256
38
+ - SHA-512
39
+ - Signed releases
40
+ - Add CHANGELOG.md
41
+ - Add SECURITY.md (Security policy)
42
+
43
+ ## [1.0.8] 2021.FEB.14
44
+
45
+ ## [1.0.7] 2021.FEB.13
46
+
47
+ ## [1.0.6] 2021.FEB.13
48
+
49
+ ## [1.0.5] 2021.FEB.13
50
+
51
+ ## [1.0.4] 2019.JUN.11
52
+
53
+ ## [1.0.3] 2019.JUN.11
54
+
55
+ ## [1.0.2] 2019.JUN.11
56
+
57
+ ## [1.0.1] 2019.MAY.10
58
+
59
+ ## [1.0.0] 2018.NOV.29
60
+
61
+ ## [0.1.5] yanked
62
+
63
+ ## [0.1.4] 2018.NOV.29
64
+
65
+ ## [0.1.3] 2018.NOV.28
66
+
67
+ ## [0.1.2] 2018.SEP.10
68
+
69
+ ## [0.1.1] 2018.SEP.09
70
+
71
+ ## [0.1.0] 2018.JAN.04
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,60 @@
1
+ ## Contributing
2
+
3
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/pboling/anonymous_active_record][🚎src-main].
4
+ This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
5
+ the [code of conduct][🤝conduct].
6
+
7
+ To submit a patch, please fork the project and create a patch with tests. Once you're happy with it send a pull request.
8
+
9
+ ## Development
10
+
11
+ After checking out the repo, run `bin/setup` to install dependencies.
12
+ Then, run `bin/rake` to run the default rake tasks, which include specs.
13
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
14
+
15
+ ## Release
16
+
17
+ ### One-time, Per-developer, Setup
18
+
19
+ **IMPORTANT**: Your public key for signing gems will need to be picked up by the line in the
20
+ `gemspec` defining the `spec.cert_chain` (check the relevant ENV variables there),
21
+ in order to sign the new release.
22
+ See: [RubyGems Security Guide][🔒️rubygems-security-guide]
23
+
24
+ ### To release a new version:
25
+
26
+ 1. Run `bin/setup && bin/rake` as a tests, coverage, & linting sanity check
27
+ 2. Update the version number in `version.rb`
28
+ 3. Run `bin/setup && bin/rake` again as a secondary check, and to update `Gemfile.lock`
29
+ 4. Run `git commit -am "🔖 Prepare release v<VERSION>"` to commit the changes
30
+ 5. Run `git push` to trigger the final CI pipeline before release, & merge PRs
31
+ - NOTE: Remember to [check the build][🧪build]!
32
+ 6. Run `export GIT_TRUNK_BRANCH_NAME="$(git remote show origin | grep 'HEAD branch' | cut -d ' ' -f5)" && echo $GIT_TRUNK_BRANCH_NAME`
33
+ 7. Run `git checkout $GIT_TRUNK_BRANCH_NAME`
34
+ 8. Run `git pull origin $GIT_TRUNK_BRANCH_NAME` to ensure you will release the latest trunk code
35
+ 9. Set `SOURCE_DATE_EPOCH` so `rake build` and `rake release` use same timestamp, and generate same checksums
36
+ - Run `export SOURCE_DATE_EPOCH=$EPOCHSECONDS && echo $SOURCE_DATE_EPOCH`
37
+ - If the echo above has no output, then it didn't work.
38
+ - Note that you'll need the `zsh/datetime` module, if running `zsh`.
39
+ - In `bash` you can use `date +%s` instead, i.e. `export SOURCE_DATE_EPOCH=$(date +%s) && echo $SOURCE_DATE_EPOCH`
40
+ 10. Run `bundle exec rake build`
41
+ 11. Run `bin/checksums` (more [context][🔒️rubygems-checksums-pr]) to create SHA-256 and SHA-512 checksums
42
+ - Checksums will be committed automatically by the script, but not pushed
43
+ 12. Run `bundle exec rake release` which will create a git tag for the version,
44
+ push git commits and tags, and push the `.gem` file to [rubygems.org][💎rubygems]
45
+
46
+ ## Contributors
47
+
48
+ [![Contributors][🖐contributors-img]][🖐contributors]
49
+
50
+ Made with [contributors-img][🖐contrib-rocks].
51
+
52
+ [🧪build]: https://github.com/pboling/anonymous_active_record/actions
53
+ [🤝conduct]: https://github.com/pboling/anonymous_active_record/blob/main/CODE_OF_CONDUCT.md
54
+ [🖐contrib-rocks]: https://contrib.rocks
55
+ [🖐contributors]: https://github.com/pboling/anonymous_active_record/graphs/contributors
56
+ [🖐contributors-img]: https://contrib.rocks/image?repo=pboling/anonymous_active_record
57
+ [💎rubygems]: https://rubygems.org
58
+ [🔒️rubygems-security-guide]: https://guides.rubygems.org/security/#building-gems
59
+ [🔒️rubygems-checksums-pr]: https://github.com/rubygems/guides/pull/325
60
+ [🚎src-main]: https://github.com/pboling/anonymous_active_record
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 - 2022, 2024 Peter H. Boling, http://railsbling.com
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,52 +1,127 @@
1
1
  # AnonymousActiveRecord
2
2
 
3
+ <div id="badges">
4
+
5
+ <div align="center">
6
+
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
8
+ [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fpboling%2Fanonymous_active_record.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fpboling%2Fanonymous_active_record?ref=badge_shield)
9
+ [![Version](https://img.shields.io/gem/v/anonymous_active_record.svg)](https://rubygems.org/gems/anonymous_active_record)
10
+ [![Downloads Today](https://img.shields.io/gem/rd/anonymous_active_record.svg)](https://github.com/pboling/anonymous_active_record)
11
+ [![Depfu](https://badges.depfu.com/badges/272ce0df3bc6df5cbea9354e2c3b65af/overview.svg)](https://depfu.com/github/pboling/anonymous_active_record?project_id=5614)
12
+ [![CodeCov][🖇codecov-img♻️]][🖇codecov]
13
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/fe504d4ab2fb77cecf7d/test_coverage)](https://codeclimate.com/github/pboling/anonymous_active_record/test_coverage)
14
+ [![Maintainability](https://api.codeclimate.com/v1/badges/fe504d4ab2fb77cecf7d/maintainability)](https://codeclimate.com/github/pboling/anonymous_active_record/maintainability)
15
+ [![CI Supported Build][🚎s-wfi]][🚎s-wf]
16
+ [![CI Unsupported Build][🚎us-wfi]][🚎us-wf]
17
+ [![CI Style Build][🚎st-wfi]][🚎st-wf]
18
+ [![CI Coverage Build][🚎cov-wfi]][🚎cov-wf]
19
+ [![CI Heads Build][🚎hd-wfi]][🚎hd-wf]
20
+ [![CI Ancient Build][🚎an-wfi]][🚎an-wf]
21
+ [![CI Dead Build][🚎ded-wfi]][🚎ded-wf]
22
+
23
+ [🖇codecov-img♻️]: https://codecov.io/gh/pboling/anonymous_active_record/graph/badge.svg?token=FLAk5BEAkv
24
+ [🖇codecov]: https://codecov.io/gh/pboling/anonymous_active_record
25
+ [🚎s-wf]: https://github.com/pboling/anonymous_active_record/actions/workflows/supported.yml
26
+ [🚎s-wfi]: https://github.com/pboling/anonymous_active_record/actions/workflows/supported.yml/badge.svg
27
+ [🚎us-wf]: https://github.com/pboling/anonymous_active_record/actions/workflows/unsupported.yml
28
+ [🚎us-wfi]: https://github.com/pboling/anonymous_active_record/actions/workflows/unsupported.yml/badge.svg
29
+ [🚎st-wf]: https://github.com/pboling/anonymous_active_record/actions/workflows/style.yml
30
+ [🚎st-wfi]: https://github.com/pboling/anonymous_active_record/actions/workflows/style.yml/badge.svg
31
+ [🚎cov-wf]: https://github.com/pboling/anonymous_active_record/actions/workflows/coverage.yml
32
+ [🚎cov-wfi]: https://github.com/pboling/anonymous_active_record/actions/workflows/coverage.yml/badge.svg
33
+ [🚎hd-wf]: https://github.com/pboling/anonymous_active_record/actions/workflows/heads.yml
34
+ [🚎hd-wfi]: https://github.com/pboling/anonymous_active_record/actions/workflows/heads.yml/badge.svg
35
+ [🚎an-wf]: https://github.com/pboling/anonymous_active_record/actions/workflows/ancient.yml
36
+ [🚎an-wfi]: https://github.com/pboling/anonymous_active_record/actions/workflows/ancient.yml/badge.svg
37
+ [🚎ded-wf]: https://github.com/pboling/anonymous_active_record/actions/workflows/dead.yml
38
+ [🚎ded-wfi]: https://github.com/pboling/anonymous_active_record/actions/workflows/dead.yml/badge.svg
39
+
40
+ </div>
41
+
42
+ -----
43
+
44
+ <div align="center">
45
+
46
+ [![Liberapay Patrons][⛳liberapay-img]][⛳liberapay]
47
+ [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor]
48
+ [![Polar Shield][🖇polar-img]][🖇polar]
49
+ [![Donate to my FLOSS or refugee efforts at ko-fi.com][🖇kofi-img]][🖇kofi]
50
+ [![Donate to my FLOSS or refugee efforts using Patreon][🖇patreon-img]][🖇patreon]
51
+
52
+ [⛳liberapay-img]: https://img.shields.io/liberapay/patrons/pboling.svg?logo=liberapay
53
+ [⛳liberapay]: https://liberapay.com/pboling/donate
54
+ [🖇sponsor-img]: https://img.shields.io/badge/Sponsor_Me!-pboling.svg?style=social&logo=github
55
+ [🖇sponsor]: https://github.com/sponsors/pboling
56
+ [🖇polar-img]: https://polar.sh/embed/seeks-funding-shield.svg?org=pboling
57
+ [🖇polar]: https://polar.sh/pboling
58
+ [🖇kofi-img]: https://img.shields.io/badge/buy%20me%20coffee-donate-yellow.svg
59
+ [🖇kofi]: https://ko-fi.com/O5O86SNP4
60
+ [🖇patreon-img]: https://img.shields.io/badge/patreon-donate-yellow.svg
61
+ [🖇patreon]: https://patreon.com/galtzo
62
+
63
+ <span class="badge-buymealatte">
64
+ <a href="https://www.buymeacoffee.com/pboling"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a latte&emoji=&slug=pboling&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff" /></a>
65
+ </span>
66
+
67
+ </div>
68
+ </div>
69
+
3
70
  This library was 🎩 inspired by 🎩, the [Wolverine project](https://github.com/mcary/wolverine), which [implemented a clever workaround](https://github.com/mcary/wolverine/commit/fa27fa2cc485b2fa83d71b2045ba5a0a069dba75) to the official non-support of [anonymous classes by ActiveRecord](https://github.com/rails/rails/issues/8934).
4
71
 
5
72
  Warning: Use of this gem is a **security risk**, due to the use of Ruby's `eval`. It is intended for use in a test suite, or other non-critical environment.
6
73
 
7
- | Project | AnonymousActiveRecord |
8
- |------------------------ | ----------------------- |
9
- | gem name | [anonymous_active_record](https://rubygems.org/gems/anonymous_active_record) |
10
- | license | [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) |
11
- | download rank | [![Downloads Today](https://img.shields.io/gem/rd/anonymous_active_record.svg)](https://github.com/pboling/anonymous_active_record) |
12
- | version | [![Version](https://img.shields.io/gem/v/anonymous_active_record.svg)](https://rubygems.org/gems/anonymous_active_record) |
13
- | dependencies | [![Depfu](https://badges.depfu.com/badges/272ce0df3bc6df5cbea9354e2c3b65af/count.svg)](https://depfu.com/github/pboling/anonymous_active_record?project_id=5614) |
14
- | continuous integration | [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fpboling%2Fanonymous_active_record%2Fbadge&style=flat)](https://actions-badge.atrox.dev/pboling/anonymous_active_record/goto) |
15
- | test coverage | [![Test Coverage](https://api.codeclimate.com/v1/badges/fe504d4ab2fb77cecf7d/test_coverage)](https://codeclimate.com/github/pboling/anonymous_active_record/test_coverage) |
16
- | maintainability | [![Maintainability](https://api.codeclimate.com/v1/badges/fe504d4ab2fb77cecf7d/maintainability)](https://codeclimate.com/github/pboling/anonymous_active_record/maintainability) |
17
- | code triage | [![Open Source Helpers](https://www.codetriage.com/pboling/anonymous_active_record/badges/users.svg)](https://www.codetriage.com/pboling/anonymous_active_record) |
18
- | FOSSA Licenses | [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fpboling%2Fanonymous_active_record.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fpboling%2Fanonymous_active_record?ref=badge_shield) |
19
- | homepage | [on Github.com][homepage], [on Railsbling.com][blogpage] |
20
- | documentation | [on RDoc.info][documentation] |
21
- | Spread ~♡ⓛⓞⓥⓔ♡~ | [🌏](https://about.me/peter.boling), [👼](https://angel.co/peter-boling), [:shipit:](http://coderwall.com/pboling), [![Tweet Peter](https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow)](http://twitter.com/galtzo), [🌹](https://nationalprogressiveparty.org) |
74
+ | Project | AnonymousActiveRecord |
75
+ |----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
76
+ | gem name | [anonymous_active_record](https://rubygems.org/gems/anonymous_active_record) |
77
+ | documentation | [on Github.com][homepage], [on RDoc.info][documentation], [![on Railsbling.com][🚎blog-img]][🚎blog] |
78
+ | code triage | [![Open Source Helpers](https://www.codetriage.com/pboling/anonymous_active_record/badges/users.svg)](https://www.codetriage.com/pboling/anonymous_active_record) |
79
+ | expert support | [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github) |
80
+ | `...` 💖 | [![Liberapay Patrons][⛳liberapay-img]][⛳liberapay] [![Sponsor Me][🖇sponsor-img]][🖇sponsor] [![Follow Me on LinkedIn][🖇linkedin-img]][🖇linkedin] [![Find Me on WellFound:][✌️wellfound-img]][✌️wellfound] [![Find Me on CrunchBase][💲crunchbase-img]][💲crunchbase] [![My LinkTree][🌳linktree-img]][🌳linktree] [![Follow Me on Ruby.Social][🐘ruby-mast-img]][🐘ruby-mast] [![Tweet @ Peter][🐦tweet-img]][🐦tweet] [💻][coderme] [🌏][aboutme] |
81
+
82
+ <!-- 7️⃣ spread 💖 -->
83
+ [🐦tweet-img]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow%20%40galtzo
84
+ [🐦tweet]: http://twitter.com/galtzo
85
+ [🚎blog]: http://www.railsbling.com/tags/anonymous_active_record/
86
+ [🚎blog-img]: https://img.shields.io/badge/blog-railsbling-brightgreen.svg?style=flat
87
+ [🖇linkedin]: http://www.linkedin.com/in/peterboling
88
+ [🖇linkedin-img]: https://img.shields.io/badge/PeterBoling-blue?style=plastic&logo=linkedin
89
+ [✌️wellfound]: https://angel.co/u/peter-boling
90
+ [✌️wellfound-img]: https://img.shields.io/badge/peter--boling-orange?style=plastic&logo=wellfound
91
+ [💲crunchbase]: https://www.crunchbase.com/person/peter-boling
92
+ [💲crunchbase-img]: https://img.shields.io/badge/peter--boling-purple?style=plastic&logo=crunchbase
93
+ [🐘ruby-mast]: https://ruby.social/@galtzo
94
+ [🐘ruby-mast-img]: https://img.shields.io/mastodon/follow/109447111526622197?domain=https%3A%2F%2Fruby.social&style=plastic&logo=mastodon&label=Ruby%20%40galtzo
95
+ [🌳linktree]: https://linktr.ee/galtzo
96
+ [🌳linktree-img]: https://img.shields.io/badge/galtzo-purple?style=plastic&logo=linktree
97
+
98
+ <!-- Maintainer Contact Links -->
99
+ [aboutme]: https://about.me/peter.boling
100
+ [coderme]: https://coderwall.com/Peter%20Boling
22
101
 
23
102
  ## Installation
24
103
 
25
- Add this line to your application's Gemfile:
26
-
27
- ```ruby
28
- gem 'anonymous_active_record'
29
- ```
104
+ Install the gem and add to the application's Gemfile by executing,
105
+ adding the `--group test` on the end if you will only use it for testing
106
+ (which is the only way it should be used):
30
107
 
31
- And then execute:
108
+ $ bundle add anonymous_active_record --group test
32
109
 
33
- $ bundle
34
-
35
- Or install it yourself as:
110
+ If bundler is not being used to manage dependencies, install the gem by executing:
36
111
 
37
112
  $ gem install anonymous_active_record
38
113
 
39
114
  ## Compatibility
40
115
 
41
- This gem is compatible with, as of Feb 2021:
42
- • Ruby 2.4, 2.5, 2.6, 2.7, 3.0, ruby-head
116
+ This gem is compatible with, as of Sep 2024:
117
+ • Ruby 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, ruby-head, truffleruby-head
43
118
 
44
119
  ## Usage
45
120
 
46
121
  Require the library in your `spec_helper` or other test suite boot file.
47
122
 
48
123
  ```ruby
49
- require 'anonymous_active_record'
124
+ require "anonymous_active_record"
50
125
  ```
51
126
 
52
127
  Let's say you want to write specs for a module, `HasBalloon`, which provides a method `has_balloon?`, and will be mixed into ActiveRecord classes.
@@ -54,7 +129,7 @@ Let's say you want to write specs for a module, `HasBalloon`, which provides a m
54
129
  ```ruby
55
130
  module HasBalloon
56
131
  def has_balloon?
57
- name == 'Spot' # only Spot has a balloon
132
+ name == "Spot" # only Spot has a balloon
58
133
  end
59
134
  end
60
135
  ```
@@ -71,7 +146,7 @@ let(:ar_with_balloon) do
71
146
  "#{b_f}#{name}#{b_f}"
72
147
  end
73
148
  def b_f
74
- has_balloon? ? '🎈' : '🌸'
149
+ has_balloon? ? "🎈" : "🌸"
75
150
  end
76
151
  end
77
152
  end
@@ -81,19 +156,19 @@ So do this instead:
81
156
 
82
157
  ```ruby
83
158
  let(:ar_with_balloon) do
84
- AnonymousActiveRecord.generate(columns: ['name']) do
159
+ AnonymousActiveRecord.generate(columns: ["name"]) do
85
160
  include HasBalloon
86
161
  def flowery_name
87
162
  "#{b_f}#{name}#{b_f}"
88
163
  end
89
164
  def b_f
90
- has_balloon? ? '🎈' : '🌸'
165
+ has_balloon? ? "🎈" : "🌸"
91
166
  end
92
167
  end
93
168
  end
94
- it 'can test the module' do
95
- expect(ar_with_balloon.new(name: 'Spot').flowery_name).to eq('🎈Spot🎈')
96
- expect(ar_with_balloon.new(name: 'Not Spot').flowery_name).to eq('🌸Not Spot🌸')
169
+ it "can test the module" do
170
+ expect(ar_with_balloon.new(name: "Spot").flowery_name).to(eq("🎈Spot🎈"))
171
+ expect(ar_with_balloon.new(name: "Not Spot").flowery_name).to(eq("🌸Not Spot🌸"))
97
172
  end
98
173
  ```
99
174
 
@@ -101,23 +176,23 @@ end
101
176
 
102
177
  ```ruby
103
178
  AnonymousActiveRecord.generate(
104
- table_name: 'a_table_name',
179
+ table_name: "a_table_name",
105
180
  # if table_name is not set klass_basename will be used to derive a unique random table_name
106
181
  # default is a unique random table name
107
- klass_basename: 'anons', # is default
108
- columns: ['name'],
182
+ klass_basename: "anons", # is default
183
+ columns: ["name"],
109
184
  # columns default is [],
110
185
  # meaning class will have ['id', 'created_at', 'updated_at'], as the AR defaults
111
186
  # Optionally provide an array of hashes and thereby designate column type:
112
187
  # [{name: 'name', type: 'string'}, {name: 'baked_at', type: 'time'}]
113
188
  timestamps: true, # is default
114
- indexes: [{ columns: ['name'], unique: true }],
189
+ indexes: [{columns: ["name"], unique: true}],
115
190
  # indexes default is [],
116
191
  # meaning class will have no indexes, as the AR defaults
117
192
  # Optionally provide an array of hashes of index options (similar to those used in Rails migrations):
118
193
  # [{columns: ['name'], unique: true}, {columns: ['baked_at']}]
119
- connection_params: { adapter: 'sqlite3', encoding: 'utf8', database: ':memory:' } # is default
120
- ) do
194
+ connection_params: {adapter: "sqlite3", encoding: "utf8", database: ":memory:"}, # is default
195
+ ) do
121
196
  # code which becomes part of the class definition
122
197
  end
123
198
  ```
@@ -128,10 +203,10 @@ The block is optional.
128
203
 
129
204
  ```ruby
130
205
  AnonymousActiveRecord.factory(
131
- source_data: [{ name: 'Phil' }, { name: 'Vickie' }]
206
+ source_data: [{name: "Phil"}, {name: "Vickie"}],
132
207
  # Array of hashes, where each hash represents a record that will be created
133
208
  # ... The rest of the options are the same as for generate, see above.
134
- ) do
209
+ ) do
135
210
  # same as for generate, see above.
136
211
  end
137
212
  ```
@@ -140,51 +215,99 @@ The block is optional.
140
215
 
141
216
  There is also a `factory!` method that will raise if the create fails, accomplished by calling `create!` instead of `create`.
142
217
 
143
- ## Development
218
+ ## 🤝 Contributing
219
+
220
+ See [CONTRIBUTING.md][🤝contributing]
221
+
222
+ [🤝contributing]: CONTRIBUTING.md
223
+
224
+ ### Code Coverage
225
+
226
+ If you need some ideas of where to help, you could work on adding more code coverage.
227
+
228
+ [![Coverage Graph][🔑codecov-g]][🖇codecov]
144
229
 
145
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
230
+ [🔑codecov-g]: https://codecov.io/gh/pboling/anonymous_active_record/graphs/tree.svg?token=FLAk5BEAkv
146
231
 
147
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
232
+ ## 🌈 Contributors
148
233
 
149
- ## Contributing
234
+ [![Contributors][🖐contributors-img]][🖐contributors]
150
235
 
151
- Bug reports and pull requests are welcome on GitHub at https://github.com/pboling/anonymous_active_record. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
236
+ Made with [contributors-img][🖐contrib-rocks].
152
237
 
153
- ## Code of Conduct
238
+ [🖐contrib-rocks]: https://contrib.rocks
239
+ [🖐contributors]: https://github.com/pboling/anonymous_active_record/graphs/contributors
240
+ [🖐contributors-img]: https://contrib.rocks/image?repo=pboling/anonymous_active_record
154
241
 
155
- Everyone interacting in the AnonymousActiveRecord project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/pboling/anonymous_active_record/blob/master/CODE_OF_CONDUCT.md).
242
+ ## Star History
156
243
 
157
- ## Versioning
244
+ <a href="https://star-history.com/#pboling/anonymous_active_record&Date">
245
+ <picture>
246
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=pboling/anonymous_active_record&type=Date&theme=dark" />
247
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=pboling/anonymous_active_record&type=Date" />
248
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=pboling/anonymous_active_record&type=Date" />
249
+ </picture>
250
+ </a>
158
251
 
159
- This library aims to adhere to [Semantic Versioning 2.0.0][semver].
160
- Violations of this scheme should be reported as bugs. Specifically,
161
- if a minor or patch version is released that breaks backward
162
- compatibility, a new version should be immediately released that
163
- restores compatibility. Breaking changes to the public API will
164
- only be introduced with new major versions.
252
+ ## 🪇 Code of Conduct
165
253
 
166
- As a result of this policy, you can (and should) specify a
167
- dependency on this gem using the [Pessimistic Version Constraint][pvc] with two digits of precision.
254
+ Everyone interacting in this project's codebases, issue trackers,
255
+ chat rooms and mailing lists is expected to follow the [code of conduct][🪇conduct].
256
+
257
+ [🪇conduct]: CODE_OF_CONDUCT.md
258
+
259
+ ## 📌 Versioning
260
+
261
+ This Library adheres to [Semantic Versioning 2.0.0][📌semver].
262
+ Violations of this scheme should be reported as bugs.
263
+ Specifically, if a minor or patch version is released that breaks backward compatibility,
264
+ a new version should be immediately released that restores compatibility.
265
+ Breaking changes to the public API will only be introduced with new major versions.
266
+
267
+ To get a better understanding of how SemVer is intended to work over a project's lifetime,
268
+ read this article from the creator of SemVer:
269
+
270
+ - ["Major Version Numbers are Not Sacred"][📌major-versions-not-sacred]
271
+
272
+ As a result of this policy, you can (and should) specify a dependency on these libraries using
273
+ the [Pessimistic Version Constraint][📌pvc] with two digits of precision.
168
274
 
169
275
  For example:
170
276
 
171
277
  ```ruby
172
- spec.add_dependency 'anonymous_active_record', '~> 0.0'
278
+ spec.add_dependency("anonymous_active_record", "~> 1.0")
173
279
  ```
174
280
 
175
- ## License
281
+ See [CHANGELOG.md][📌changelog] for list of releases.
176
282
 
177
- * Copyright (c) 2018 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
283
+ [comment]: <> ( 📌 VERSIONING LINKS )
178
284
 
179
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
285
+ [📌pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
286
+ [📌semver]: http://semver.org/
287
+ [📌major-versions-not-sacred]: https://tom.preston-werner.com/2022/05/23/major-version-numbers-are-not-sacred.html
288
+ [📌changelog]: CHANGELOG.md
289
+
290
+ ## 📄 License
291
+
292
+ The gem is available as open source under the terms of
293
+ the [MIT License][📄license] [![License: MIT][📄license-img]][📄license-ref].
294
+ See [LICENSE.txt][📄license] for the official [Copyright Notice][📄copyright-notice-explainer].
180
295
 
181
296
  [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fpboling%2Fanonymous_active_record.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fpboling%2Fanonymous_active_record?ref=badge_large)
182
297
 
183
- [license]: LICENSE
184
- [semver]: http://semver.org/
185
- [pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
298
+ [comment]: <> ( 📄 LEGAL LINKS )
299
+
300
+ [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
301
+ [📄license]: LICENSE.txt
302
+ [📄license-ref]: https://opensource.org/licenses/MIT
303
+ [📄license-img]: https://img.shields.io/badge/License-MIT-green.svg
304
+
305
+ ### © Copyright
306
+
307
+ * Copyright (c) 2017 - 2022, 2024 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
308
+
186
309
  [railsbling]: http://www.railsbling.com
187
310
  [peterboling]: http://www.peterboling.com
311
+ [bundle-group-pattern]: https://gist.github.com/pboling/4564780
188
312
  [documentation]: http://rdoc.info/github/pboling/anonymous_active_record/frames
189
- [homepage]: https://github.com/pboling/anonymous_active_record/
190
- [blogpage]: http://www.railsbling.com/tags/anonymous_active_record/
313
+ [homepage]: https://github.com/pboling/anonymous_active_record
data/SECURITY.md ADDED
@@ -0,0 +1,14 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ |---------|-----------|
7
+ | 1.x | ✅ |
8
+ | 0.x | ❌ |
9
+
10
+ ## Reporting a Vulnerability
11
+
12
+ Peter Boling is the primary maintainer of this gem. Please find a way
13
+ to [contact him directly](https://railsbling.com/contact) to report the issue. Include as much relevant information as
14
+ possible.
@@ -14,17 +14,19 @@
14
14
  module AnonymousActiveRecord
15
15
  # Generator defines a pseudo anonymous class in a particular namespace of your choosing.
16
16
  class Generator
17
- DEFAULT_NAME = 'anons'
17
+ DEFAULT_NAME = "anons"
18
18
 
19
19
  attr_reader :klass_namespaces, :table_name, :klass_name, :parent_klass
20
20
 
21
- def initialize(table_name, klass_namespaces = [], klass_basename = nil, parent_klass = 'ActiveRecord::Base')
22
- @klass_namespaces = Array(klass_namespaces).map(&:to_s).map { |x| x.gsub(/[^a-z0-9]+/i, '_') }
23
- klass_context = [(klass_basename || DEFAULT_NAME).gsub(/[^a-z0-9]+/i, '_').capitalize,
24
- SecureRandom.uuid.gsub(/[^a-z0-9]+/i, '_')].join('_')
21
+ def initialize(table_name, klass_namespaces = [], klass_basename = nil, parent_klass = "ActiveRecord::Base")
22
+ @klass_namespaces = Array(klass_namespaces).map(&:to_s).map { |x| x.gsub(/[^a-z0-9]+/i, "_") }
23
+ klass_context = [
24
+ (klass_basename || DEFAULT_NAME).gsub(/[^a-z0-9]+/i, "_").capitalize,
25
+ SecureRandom.uuid.gsub(/[^a-z0-9]+/i, "_"),
26
+ ].join("_")
25
27
  @table_name = (table_name || klass_context).downcase.to_s
26
28
  # String#capitalize is Ruby >= 2.4, https://stackoverflow.com/a/3725154/213191
27
- @klass_name = (klass_namespaces << klass_context).join('::')
29
+ @klass_name = (klass_namespaces << klass_context).join("::")
28
30
  @parent_klass = parent_klass
29
31
  end
30
32
 
@@ -33,7 +35,7 @@ module AnonymousActiveRecord
33
35
  # Class.new(ActiveRecord::Base)
34
36
  # which was useful for specs, and other use cases. But it is now explicitly not supported, see
35
37
  # https://github.com/rails/rails/issues/8934
36
- eval "class ::#{klass_name} < #{parent_klass}; end"
38
+ eval("class ::#{klass_name} < #{parent_klass}; end")
37
39
  klass = Kernel.const_get(klass_name, true)
38
40
  klass.class_eval(&block) if block
39
41
  klass.table_name = table_name
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AnonymousActiveRecord
4
- VERSION = '1.0.8'
4
+ module Version
5
+ VERSION = "1.0.9"
6
+ end
5
7
  end