flag_shih_tzu 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +46 -1
- data/CITATION.cff +2 -2
- data/CONTRIBUTING.md +17 -1
- data/FUNDING.md +11 -11
- data/LICENSE.md +27 -34
- data/README.md +37 -45
- data/SECURITY.md +1 -1
- data/lib/flag_shih_tzu/validators.rb +1 -1
- data/lib/flag_shih_tzu/version.rb +1 -1
- data/lib/flag_shih_tzu.rb +40 -38
- data/sig/flag_shih_tzu/version.rbs +0 -1
- data.tar.gz.sig +0 -0
- metadata +47 -96
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9eff6edcb8728019ada6dd76eee04f5ea30752dd39f5daf785e336475ef7cd2d
|
|
4
|
+
data.tar.gz: 19a9644b8013e2007409fc0583ce6c686b8a3e9a288d72b04256fd76addf6779
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 66a56950794f86372d41b4bf7425312024d3e7954f37cc327fde36ea5c84ba01fe7394de56b21aefa0897833356e88f60cb1cbb979319a51ce73596c162ce0a2
|
|
7
|
+
data.tar.gz: 19ff6bd795ccfd0c096ff9af83d7122b1f88c925abfb02b2f1ba76d72adf32e08a63f8c94ed656ca0bb332b362158b51ba3df6eeae1efbc90f3f492a78b64536
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,47 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
30
30
|
|
|
31
31
|
### Security
|
|
32
32
|
|
|
33
|
+
## [1.0.2] - 2026-06-14
|
|
34
|
+
|
|
35
|
+
- TAG: [v1.0.2][1.0.2t]
|
|
36
|
+
- COVERAGE: 90.75% -- 412/454 lines in 3 files
|
|
37
|
+
- BRANCH COVERAGE: 76.76% -- 142/185 branches in 3 files
|
|
38
|
+
- 27.78% documented
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- Refreshed generated README/package metadata, copyright notices, template
|
|
43
|
+
helper files, documentation custom-domain metadata, CI workflow pins, and
|
|
44
|
+
development dependency floors from the latest `kettle-jem` template.
|
|
45
|
+
|
|
46
|
+
## [1.0.1] - 2026-06-05
|
|
47
|
+
|
|
48
|
+
- TAG: [v1.0.1][1.0.1t]
|
|
49
|
+
- COVERAGE: 90.95% -- 412/453 lines in 3 files
|
|
50
|
+
- BRANCH COVERAGE: 76.76% -- 142/185 branches in 3 files
|
|
51
|
+
- 27.78% documented
|
|
52
|
+
|
|
53
|
+
### Fixed
|
|
54
|
+
|
|
55
|
+
- Fixed generated documentation URLs that incorrectly pointed at a monorepo
|
|
56
|
+
`gems/flag_shih_tzu` path.
|
|
57
|
+
|
|
58
|
+
### Changed
|
|
59
|
+
|
|
60
|
+
- Raised generated `version_gem` and `appraisal2` dependency floors to
|
|
61
|
+
`version_gem` >= 1.1.10 and `appraisal2` >= 3.0.9.
|
|
62
|
+
- Refreshed generated project metadata, support documentation, CI workflows,
|
|
63
|
+
and development dependency floors from the current kettle-jem template.
|
|
64
|
+
|
|
65
|
+
- Updated the README synopsis to call out v1.0 multi-bit field support.
|
|
66
|
+
|
|
67
|
+
### Removed
|
|
68
|
+
|
|
69
|
+
- Removed the legacy Test::Unit suite now that its coverage is represented by
|
|
70
|
+
the RSpec suite.
|
|
71
|
+
- Removed obsolete direct development dependencies on `bundler`, `rspec`,
|
|
72
|
+
`rspec_junit_formatter`, `test-unit`, and `wwtd`.
|
|
73
|
+
|
|
33
74
|
## [1.0.0] - 2026-05-26
|
|
34
75
|
|
|
35
76
|
- TAG: [v1.0.0][1.0.0t]
|
|
@@ -282,6 +323,10 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
282
323
|
|
|
283
324
|
# Version 0.2.3 - last version maintained by XING AG
|
|
284
325
|
|
|
285
|
-
[Unreleased]: https://github.com/galtzo-floss/flag_shih_tzu/compare/v1.0.
|
|
326
|
+
[Unreleased]: https://github.com/galtzo-floss/flag_shih_tzu/compare/v1.0.2...HEAD
|
|
327
|
+
[1.0.2]: https://github.com/galtzo-floss/flag_shih_tzu/compare/v1.0.1...v1.0.2
|
|
328
|
+
[1.0.2t]: https://github.com/galtzo-floss/flag_shih_tzu/releases/tag/v1.0.2
|
|
329
|
+
[1.0.1]: https://github.com/galtzo-floss/flag_shih_tzu/compare/v1.0.0...v1.0.1
|
|
330
|
+
[1.0.1t]: https://github.com/galtzo-floss/flag_shih_tzu/releases/tag/v1.0.1
|
|
286
331
|
[1.0.0]: https://github.com/galtzo-floss/flag_shih_tzu/compare/baaff102ad48e6c5b4bfb3efb088cec82fa1ddb4...v1.0.0
|
|
287
332
|
[1.0.0t]: https://github.com/galtzo-floss/flag_shih_tzu/releases/tag/v1.0.0
|
data/CITATION.cff
CHANGED
|
@@ -12,9 +12,9 @@ authors:
|
|
|
12
12
|
orcid: 'https://orcid.org/0009-0008-8519-441X'
|
|
13
13
|
identifiers:
|
|
14
14
|
- type: url
|
|
15
|
-
value: 'https://github.com/
|
|
15
|
+
value: 'https://github.com/galtzo-floss/flag_shih_tzu'
|
|
16
16
|
description: "flag_shih_tzu"
|
|
17
|
-
repository-code: 'https://github.com/
|
|
17
|
+
repository-code: 'https://github.com/galtzo-floss/flag_shih_tzu'
|
|
18
18
|
abstract: >-
|
|
19
19
|
flag_shih_tzu
|
|
20
20
|
license: See license file
|
data/CONTRIBUTING.md
CHANGED
|
@@ -102,13 +102,29 @@ Git hooks and commit message helpers (exe/kettle-commit-msg)
|
|
|
102
102
|
- GIT_HOOK_FOOTER_SENTINEL: Required when footer append is enabled — a unique first-line sentinel to prevent duplicates
|
|
103
103
|
- GIT_HOOK_FOOTER_APPEND_DEBUG: Extra debug output in the footer template (true/false)
|
|
104
104
|
|
|
105
|
+
Git diff driver setup
|
|
106
|
+
- Local setup writes repository `.gitattributes` entries and local Git `diff.smorg-*` command config so this checkout uses StructuredMerge semantic diffs.
|
|
107
|
+
- Global setup registers `diff.smorg-*` commands once in the user Git config; use it when you work across several StructuredMerge-enabled repositories.
|
|
108
|
+
- Include-file setup writes `.git/smorg/config` and includes it from local Git config, keeping command registrations out of the repository files.
|
|
109
|
+
- Git hosting forges generally ignore external diff drivers, so pull request views may still show raw textual diffs even when local `git diff` uses semantic drivers.
|
|
110
|
+
|
|
111
|
+
```console
|
|
112
|
+
K_JEM_TEMPLATING=true bundle exec kettle-jem install
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Troubleshooting Git diffs
|
|
116
|
+
- Use `git diff --no-ext-diff` to compare against Git's built-in diff output.
|
|
117
|
+
- Use `git diff --no-textconv` when a textconv projection obscures the raw file bytes you need to inspect.
|
|
118
|
+
- If Git reports a missing `smorg-*` executable, rerun `bundle install` and the setup command above, then check `git config --local --get-regexp '^diff\.smorg-'`.
|
|
119
|
+
- To remove managed local entries, run `K_JEM_TEMPLATING=true bundle exec kettle-jem install --undo`; remove global command registrations with `git config --global --unset-all diff.smorg-ruby.command`.
|
|
120
|
+
|
|
105
121
|
For a quick starting point, this repository’s `mise.toml` defines the shared defaults, and `.env.local` can override them locally. Copy `.env.local.example` to `.env.local`, use `KEY=value` lines, and either activate `mise` in your shell or run commands through `mise exec -C /path/to/project -- ...`.
|
|
106
122
|
|
|
107
123
|
## Appraisals
|
|
108
124
|
|
|
109
125
|
From time to time the [appraisal2][🚎appraisal2] gemfiles in `gemfiles/` will need to be updated.
|
|
110
126
|
Generated appraisal and CI workflow floors are controlled by `ruby.test_minimum`
|
|
111
|
-
in `.kettle-jem.yml`; this project was templated with `ruby.test_minimum: 2.4`.
|
|
127
|
+
in `.structuredmerge/kettle-jem.yml`; this project was templated with `ruby.test_minimum: 2.4`.
|
|
112
128
|
That value describes the lowest Ruby version expected to run the test/development
|
|
113
129
|
toolchain, and it may be higher than the gemspec runtime floor.
|
|
114
130
|
|
data/FUNDING.md
CHANGED
|
@@ -10,10 +10,10 @@ Many paths lead to being a sponsor or a backer of this project. Are you on such
|
|
|
10
10
|
|
|
11
11
|
[⛳liberapay-img]: https://img.shields.io/liberapay/goal/pboling.svg?logo=liberapay&color=a51611&style=flat
|
|
12
12
|
[⛳liberapay]: https://liberapay.com/pboling/donate
|
|
13
|
-
[🖇osc-backers]: https://opencollective.com
|
|
14
|
-
[🖇osc-backers-i]: https://opencollective.com
|
|
15
|
-
[🖇osc-sponsors]: https://opencollective.com
|
|
16
|
-
[🖇osc-sponsors-i]: https://opencollective.com
|
|
13
|
+
[🖇osc-backers]: https://opencollective.com/galtzo-floss#backer
|
|
14
|
+
[🖇osc-backers-i]: https://opencollective.com/galtzo-floss/backers/badge.svg?style=flat
|
|
15
|
+
[🖇osc-sponsors]: https://opencollective.com/galtzo-floss#sponsor
|
|
16
|
+
[🖇osc-sponsors-i]: https://opencollective.com/galtzo-floss/sponsors/badge.svg?style=flat
|
|
17
17
|
[🖇sponsor-img]: https://img.shields.io/badge/Sponsor_Me!-pboling.svg?style=social&logo=github
|
|
18
18
|
[🖇sponsor]: https://github.com/sponsors/pboling
|
|
19
19
|
[🖇polar-img]: https://img.shields.io/badge/polar-donate-a51611.svg?style=flat
|
|
@@ -59,13 +59,13 @@ I’m developing a new library, [floss_funding][🖇floss-funding-gem], designed
|
|
|
59
59
|
**[Floss-Funding.dev][🖇floss-funding.dev]: 👉️ No network calls. 👉️ No tracking. 👉️ No oversight. 👉️ Minimal crypto hashing. 💡 Easily disabled nags**
|
|
60
60
|
|
|
61
61
|
[⛳liberapay-bottom-img]: https://img.shields.io/liberapay/goal/pboling.svg?style=for-the-badge&logo=liberapay&color=a51611
|
|
62
|
-
[🖇osc-all-img]: https://img.shields.io/opencollective/all/
|
|
63
|
-
[🖇osc-sponsors-img]: https://img.shields.io/opencollective/sponsors/
|
|
64
|
-
[🖇osc-backers-img]: https://img.shields.io/opencollective/backers/
|
|
65
|
-
[🖇osc-all-bottom-img]: https://img.shields.io/opencollective/all
|
|
66
|
-
[🖇osc-sponsors-bottom-img]: https://img.shields.io/opencollective/sponsors
|
|
67
|
-
[🖇osc-backers-bottom-img]: https://img.shields.io/opencollective/backers
|
|
68
|
-
[🖇osc]: https://opencollective.com/
|
|
62
|
+
[🖇osc-all-img]: https://img.shields.io/opencollective/all/galtzo-floss
|
|
63
|
+
[🖇osc-sponsors-img]: https://img.shields.io/opencollective/sponsors/galtzo-floss
|
|
64
|
+
[🖇osc-backers-img]: https://img.shields.io/opencollective/backers/galtzo-floss
|
|
65
|
+
[🖇osc-all-bottom-img]: https://img.shields.io/opencollective/all/galtzo-floss?style=for-the-badge
|
|
66
|
+
[🖇osc-sponsors-bottom-img]: https://img.shields.io/opencollective/sponsors/galtzo-floss?style=for-the-badge
|
|
67
|
+
[🖇osc-backers-bottom-img]: https://img.shields.io/opencollective/backers/galtzo-floss?style=for-the-badge
|
|
68
|
+
[🖇osc]: https://opencollective.com/galtzo-floss
|
|
69
69
|
[🖇sponsor-bottom-img]: https://img.shields.io/badge/Sponsor_Me!-pboling-blue?style=for-the-badge&logo=github
|
|
70
70
|
[🖇buyme-img]: https://img.buymeacoffee.com/button-api/?text=Buy%20me%20a%20latte&emoji=&slug=pboling&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff
|
|
71
71
|
[🖇paypal-bottom-img]: https://img.shields.io/badge/donate-paypal-a51611.svg?style=for-the-badge&logo=paypal&color=0A0A0A
|
data/LICENSE.md
CHANGED
|
@@ -7,37 +7,30 @@ Choose the option that best fits your use case:
|
|
|
7
7
|
|
|
8
8
|
## Copyright Notice
|
|
9
9
|
|
|
10
|
-
Copyright (c) 2009 Alto
|
|
11
|
-
Copyright (c) 2009-
|
|
12
|
-
Copyright (c) 2009
|
|
13
|
-
Copyright (c) 2009-
|
|
14
|
-
Copyright (c) 2009
|
|
15
|
-
Copyright (c)
|
|
16
|
-
Copyright (c)
|
|
17
|
-
Copyright (c)
|
|
18
|
-
Copyright (c)
|
|
19
|
-
Copyright (c)
|
|
20
|
-
Copyright (c)
|
|
21
|
-
Copyright (c)
|
|
22
|
-
Copyright (c)
|
|
23
|
-
Copyright (c)
|
|
24
|
-
Copyright (c)
|
|
25
|
-
Copyright (c)
|
|
26
|
-
Copyright (c)
|
|
27
|
-
Copyright (c)
|
|
28
|
-
Copyright (c)
|
|
29
|
-
Copyright (c)
|
|
30
|
-
Copyright (c)
|
|
31
|
-
Copyright (c)
|
|
32
|
-
Copyright (c)
|
|
33
|
-
Copyright (c)
|
|
34
|
-
Copyright (c)
|
|
35
|
-
Copyright (c)
|
|
36
|
-
Copyright (c)
|
|
37
|
-
Copyright (c) 2017 shiro16
|
|
38
|
-
Copyright (c) 2018 Peter Boling
|
|
39
|
-
Copyright (c) 2018 xpol
|
|
40
|
-
Copyright (c) 2018 Yusuke Ebihara
|
|
41
|
-
Copyright (c) 2019 Amy Martin
|
|
42
|
-
Copyright (c) 2025 Annibelle Boling
|
|
43
|
-
Copyright (c) 2025 horiken
|
|
10
|
+
- Copyright (c) 2009 Alto
|
|
11
|
+
- Copyright (c) 2009-2011 boosty
|
|
12
|
+
- Copyright (c) 2009 ladislav.martincik
|
|
13
|
+
- Copyright (c) 2009-2011 pboling
|
|
14
|
+
- Copyright (c) 2009 XING Engineering
|
|
15
|
+
- Copyright (c) 2010 Joost Baaij
|
|
16
|
+
- Copyright (c) 2010 Joost Baaij
|
|
17
|
+
- Copyright (c) 2011 Arturas Slajus
|
|
18
|
+
- Copyright (c) 2011 Musy Bite
|
|
19
|
+
- Copyright (c) 2011, 2014 Tim Liner
|
|
20
|
+
- Copyright (c) 2012-2013 David DIDIER
|
|
21
|
+
- Copyright (c) 2012-2015, 2017-2018, 2026 Peter H. Boling
|
|
22
|
+
- Copyright (c) 2012 Tatsuhiko Miyagawa
|
|
23
|
+
- Copyright (c) 2013 Keith Pitty
|
|
24
|
+
- Copyright (c) 2013 Peter M. Goldstein
|
|
25
|
+
- Copyright (c) 2014 Alexander Tipugin
|
|
26
|
+
- Copyright (c) 2014, 2017-2018, 2025 Jonathan del Strother
|
|
27
|
+
- Copyright (c) 2015 Ivan
|
|
28
|
+
- Copyright (c) 2015 jfcaiceo
|
|
29
|
+
- Copyright (c) 2016 Xinran Xiao
|
|
30
|
+
- Copyright (c) 2017 shiro16
|
|
31
|
+
- Copyright (c) 2018 Peter Boling
|
|
32
|
+
- Copyright (c) 2018 xpol
|
|
33
|
+
- Copyright (c) 2018 Yusuke Ebihara
|
|
34
|
+
- Copyright (c) 2019 Amy Martin
|
|
35
|
+
- Copyright (c) 2025 Annibelle Boling
|
|
36
|
+
- Copyright (c) 2025 horiken
|
data/README.md
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
[🖼️galtzo-floss-i]: https://logos.galtzo.com/assets/images/galtzo-floss/avatar-192px.svg
|
|
4
|
-
[🖼️galtzo-floss]: https://discord.gg/3qme4XHNKN
|
|
5
|
-
[🖼️ruby-lang-i]: https://logos.galtzo.com/assets/images/ruby-lang/avatar-192px.svg
|
|
6
|
-
[🖼️ruby-lang]: https://www.ruby-lang.org/
|
|
7
|
-
[🖼️galtzo-floss-flag_shih_tzu-i]: https://logos.galtzo.com/assets/images/galtzo-floss/flag_shih_tzu/avatar-192px.svg
|
|
8
|
-
[🖼️galtzo-floss-flag_shih_tzu]: https://github.com/galtzo-floss/flag_shih_tzu
|
|
1
|
+
<a href="https://github.com/galtzo-floss/flag_shih_tzu"><img alt="flag_shih_tzu Logo by Aboling0, CC BY-SA 4.0" src="https://logos.galtzo.com/assets/images/galtzo-floss/flag_shih_tzu/avatar-128px.svg" width="14%" align="right"/></a>
|
|
9
2
|
|
|
10
3
|
# 🏁 FlagShihTzu
|
|
11
4
|
|
|
5
|
+
## ⚠️ v1.0.0 => breaking change in default config ⚠️
|
|
6
|
+
|
|
7
|
+
Want old behavior?
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
FlagShihTzu.default_flag_query_mode = :in_list
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
✨️ The *old behavior* is *not deprecated*, is still *more performant*, and will always *be supported*.
|
|
14
|
+
|
|
15
|
+
🦺 The new default allows *safe-by-default* rolling deployments with *flag migrations*.
|
|
16
|
+
|
|
17
|
+
📗 Read more here: https://dev.to/galtzo/why-flagshihtzu-is-changing-its-default-sql-for-bit-flags-41l9
|
|
18
|
+
|
|
12
19
|
[![Version][👽versioni]][👽version] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License: MIT][📄license-img]][📄license] [![Downloads Rank][👽dl-ranki]][👽dl-rank] [![CodeCov Test Coverage][🏀codecovi]][🏀codecov] [![Coveralls Test Coverage][🏀coveralls-img]][🏀coveralls] [![QLTY Test Coverage][🏀qlty-covi]][🏀qlty-cov] [![QLTY Maintainability][🏀qlty-mnti]][🏀qlty-mnt] [![CI Heads][🚎3-hd-wfi]][🚎3-hd-wf] [![CI Runtime Dependencies @ HEAD][🚎12-crh-wfi]][🚎12-crh-wf] [![CI Current][🚎11-c-wfi]][🚎11-c-wf] [![CI Truffle Ruby][🚎9-t-wfi]][🚎9-t-wf] [![CI JRuby][🚎10-j-wfi]][🚎10-j-wf] [![Deps Locked][🚎13-🔒️-wfi]][🚎13-🔒️-wf] [![Deps Unlocked][🚎14-🔓️-wfi]][🚎14-🔓️-wf] [![CI Test Coverage][🚎2-cov-wfi]][🚎2-cov-wf] [![CI Style][🚎5-st-wfi]][🚎5-st-wf] [![Apache SkyWalking Eyes License Compatibility Check][🚎15-🪪-wfi]][🚎15-🪪-wf] [![FOSSA Status][🧪fossa-img]][🧪fossa]
|
|
13
20
|
|
|
14
21
|
`if ci_badges.map(&:color).detect { it != "green"}` ☝️ [let me know][🖼️galtzo-floss], as I may have missed the [discord notification][🖼️galtzo-floss].
|
|
@@ -26,7 +33,7 @@ I've summarized my thoughts in [this blog post](https://dev.to/galtzo/hostile-ta
|
|
|
26
33
|
|
|
27
34
|
</details>
|
|
28
35
|
|
|
29
|
-
## 🌻 Synopsis
|
|
36
|
+
## 🌻 Synopsis <a href="https://discord.gg/3qme4XHNKN"><img alt="Galtzo FLOSS Logo by Aboling0, CC BY-SA 4.0" src="https://logos.galtzo.com/assets/images/galtzo-floss/avatar-128px.svg" width="8%" align="right"/></a> <a href="https://ruby-toolbox.com"><img alt="ruby-lang Logo, Yukihiro Matsumoto, Ruby Visual Identity Team, CC BY-SA 2.5" src="https://logos.galtzo.com/assets/images/ruby-lang/avatar-128px.svg" width="8%" align="right"/></a>
|
|
30
37
|
|
|
31
38
|
An extension for [ActiveRecord](https://rubygems.org/gems/activerecord)
|
|
32
39
|
to store a collection of boolean attributes in a single integer column
|
|
@@ -37,6 +44,11 @@ to store a collection of boolean attributes (flags). Each flag can be used
|
|
|
37
44
|
almost in the same way you would use any boolean attribute on an
|
|
38
45
|
ActiveRecord object.
|
|
39
46
|
|
|
47
|
+
New for v1.0: FlagShihTzu also supports multi-bit fields with
|
|
48
|
+
`value_mode: :tri_state`, `bit_width:`, and custom `encoder:` implementations.
|
|
49
|
+
That lets one flag slot represent `true`, `false`, and `nil`, or other
|
|
50
|
+
enum-like states you encode, while still sharing the same integer column.
|
|
51
|
+
|
|
40
52
|
The benefits:
|
|
41
53
|
|
|
42
54
|
* No schema migrations needed for new boolean attributes. This helps a lot
|
|
@@ -51,7 +63,6 @@ without needing any migration. Just add a new flag to the `has_flags` call.
|
|
|
51
63
|
|
|
52
64
|
What is a ["Shih Tzu"](http://en.wikipedia.org/wiki/Shih_Tzu)?
|
|
53
65
|
|
|
54
|
-
|
|
55
66
|
## 💡 Info you can shake a stick at
|
|
56
67
|
|
|
57
68
|
| Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
|
|
@@ -81,8 +92,6 @@ not practical for the current toolchain.
|
|
|
81
92
|
|------------------------------------------------|--------------------------------------------------------|
|
|
82
93
|
| 👟 Check it out! | ✨ [github.com/appraisal-rb/appraisal2][💎appraisal2] ✨ |
|
|
83
94
|
|
|
84
|
-
|
|
85
|
-
|
|
86
95
|
### Federated DVCS
|
|
87
96
|
|
|
88
97
|
<details markdown="1">
|
|
@@ -138,7 +147,6 @@ gem install flag_shih_tzu
|
|
|
138
147
|
|
|
139
148
|
## ⚙️ Configuration
|
|
140
149
|
|
|
141
|
-
|
|
142
150
|
## 🔧 Basic Usage
|
|
143
151
|
|
|
144
152
|
FlagShihTzu assumes that your ActiveRecord model already has an [integer field][bit_field]
|
|
@@ -193,7 +201,6 @@ has_flags 1 => :warpdrive,
|
|
|
193
201
|
:allow_overwrite => true
|
|
194
202
|
```
|
|
195
203
|
|
|
196
|
-
|
|
197
204
|
### Bit Fields: How it stores the values
|
|
198
205
|
|
|
199
206
|
As said, FlagShihTzu uses a single integer column to store the values for all
|
|
@@ -231,7 +238,6 @@ and check individual flags.
|
|
|
231
238
|
|
|
232
239
|
Read more about [bit fields][bit_field] here: http://en.wikipedia.org/wiki/Bit_field
|
|
233
240
|
|
|
234
|
-
|
|
235
241
|
### Flag value modes and custom encoders
|
|
236
242
|
|
|
237
243
|
By default, each flag uses boolean mode. This keeps the historical one-bit
|
|
@@ -247,7 +253,7 @@ This is equivalent to:
|
|
|
247
253
|
```ruby
|
|
248
254
|
has_flags(
|
|
249
255
|
{1 => :warpdrive, 2 => :shields},
|
|
250
|
-
value_mode: :boolean
|
|
256
|
+
value_mode: :boolean
|
|
251
257
|
)
|
|
252
258
|
```
|
|
253
259
|
|
|
@@ -256,7 +262,7 @@ For flags that need `true`, `false`, and `nil`, use tri-state mode:
|
|
|
256
262
|
```ruby
|
|
257
263
|
has_flags(
|
|
258
264
|
{1 => :warpdrive, 2 => :shields},
|
|
259
|
-
value_mode: :tri_state
|
|
265
|
+
value_mode: :tri_state
|
|
260
266
|
)
|
|
261
267
|
```
|
|
262
268
|
|
|
@@ -291,7 +297,7 @@ Applications with specialized storage needs can provide a custom encoder:
|
|
|
291
297
|
has_flags(
|
|
292
298
|
{1 => :warpdrive},
|
|
293
299
|
bit_width: 2,
|
|
294
|
-
encoder: MyFlagEncoder
|
|
300
|
+
encoder: MyFlagEncoder
|
|
295
301
|
)
|
|
296
302
|
```
|
|
297
303
|
|
|
@@ -301,7 +307,6 @@ storage. You can still pass `bit_width: 1` or `bit_width: 2` directly, but
|
|
|
301
307
|
API. If you set `bit_width: 3` or higher, you must provide an encoder so
|
|
302
308
|
FlagShihTzu does not guess what the extra states mean.
|
|
303
309
|
|
|
304
|
-
|
|
305
310
|
### Using a custom column name
|
|
306
311
|
|
|
307
312
|
The default column name to store the flags is `flags`, but you can provide a
|
|
@@ -359,7 +364,6 @@ on Spaceship:
|
|
|
359
364
|
Spaceship#electrolytes_changed?
|
|
360
365
|
Spaceship#has_electrolyte?
|
|
361
366
|
|
|
362
|
-
|
|
363
367
|
### Callbacks and Validations
|
|
364
368
|
|
|
365
369
|
Optionally, you can set the `:bang_methods` option to true to also define the bang methods:
|
|
@@ -376,14 +380,12 @@ Alternatively, if you do want to *save a flag* to the database, while still avoi
|
|
|
376
380
|
* sets a flag on a database record without triggering callbacks or validations
|
|
377
381
|
* optionally syncs the ruby instance with new flag value, by default it does not.
|
|
378
382
|
|
|
379
|
-
|
|
380
383
|
Example:
|
|
381
384
|
|
|
382
385
|
```ruby
|
|
383
386
|
update_flag!(flag_name, flag_value, update_instance = false)
|
|
384
387
|
```
|
|
385
388
|
|
|
386
|
-
|
|
387
389
|
### Generated class methods
|
|
388
390
|
|
|
389
391
|
Calling `has_flags` as shown above creates the following class methods
|
|
@@ -393,7 +395,6 @@ on Spaceship:
|
|
|
393
395
|
Spaceship.flag_columns # [:features, :crew]
|
|
394
396
|
```
|
|
395
397
|
|
|
396
|
-
|
|
397
398
|
### Generated named scopes
|
|
398
399
|
|
|
399
400
|
The following named scopes become available:
|
|
@@ -417,7 +418,6 @@ has_flags 1 => :warpdrive, 2 => :shields, 3 => :electrolytes, :named_scopes => f
|
|
|
417
418
|
In a Rails 3+ application, FlagShihTzu will use `scope` internally to generate
|
|
418
419
|
the scopes. The option on `has_flags` is still named `:named_scopes` however.
|
|
419
420
|
|
|
420
|
-
|
|
421
421
|
### Examples for using the generated methods
|
|
422
422
|
|
|
423
423
|
```ruby
|
|
@@ -461,7 +461,7 @@ Assigning a hash updates only the mentioned flags and preserves the rest:
|
|
|
461
461
|
```ruby
|
|
462
462
|
enterprise.flags = {
|
|
463
463
|
warpdrive: true,
|
|
464
|
-
shields: false
|
|
464
|
+
shields: false
|
|
465
465
|
}
|
|
466
466
|
```
|
|
467
467
|
|
|
@@ -500,7 +500,6 @@ enterprise.attributes_with_flags
|
|
|
500
500
|
# {"id" => 1, "features" => 1, "warpdrive" => true, "shields" => false, ...}
|
|
501
501
|
```
|
|
502
502
|
|
|
503
|
-
|
|
504
503
|
### Support for manually building conditions
|
|
505
504
|
|
|
506
505
|
The following class methods may support you when manually building
|
|
@@ -521,7 +520,6 @@ generating SQL that references the same table more than once:
|
|
|
521
520
|
Spaceship.shields_condition(table_alias: "evil_spaceships") # "(evil_spaceships.flags & 2 = 2)"
|
|
522
521
|
```
|
|
523
522
|
|
|
524
|
-
|
|
525
523
|
### Choosing a query mode
|
|
526
524
|
|
|
527
525
|
By default, FlagShihTzu builds SQL conditions with bit operators:
|
|
@@ -633,7 +631,7 @@ Recommended removal path:
|
|
|
633
631
|
|
|
634
632
|
```ruby
|
|
635
633
|
Spaceship.where(Spaceship.shields_condition).update_all(
|
|
636
|
-
Spaceship.set_flag_sql(:shields, false)
|
|
634
|
+
Spaceship.set_flag_sql(:shields, false)
|
|
637
635
|
)
|
|
638
636
|
```
|
|
639
637
|
|
|
@@ -782,7 +780,6 @@ of his code better, and some of my code better. I've been wanting to do a full
|
|
|
782
780
|
rewrite of `flag_shih_tzu` ever since I inherited the project from
|
|
783
781
|
[XING](https://github.com/xing), but I haven't had time. So I don't know.
|
|
784
782
|
|
|
785
|
-
|
|
786
783
|
## 🦷 FLOSS Funding
|
|
787
784
|
|
|
788
785
|
While galtzo-floss tools are free software and will always be, the project would benefit immensely from some funding.
|
|
@@ -905,7 +902,7 @@ For most applications, prefer the [Pessimistic Version Constraint][📌pvc] with
|
|
|
905
902
|
For example:
|
|
906
903
|
|
|
907
904
|
```ruby
|
|
908
|
-
spec.add_dependency("flag_shih_tzu", "~>
|
|
905
|
+
spec.add_dependency("flag_shih_tzu", "~> 1.0")
|
|
909
906
|
```
|
|
910
907
|
|
|
911
908
|
<details markdown="1">
|
|
@@ -936,27 +933,20 @@ See [LICENSE.md][📄license] for the official copyright notice.
|
|
|
936
933
|
<summary>Copyright holders</summary>
|
|
937
934
|
|
|
938
935
|
- Copyright (c) 2009 Alto
|
|
939
|
-
- Copyright (c) 2009-
|
|
940
|
-
- Copyright (c) 2009
|
|
941
|
-
- Copyright (c) 2009-2010 ladislav.martincik
|
|
942
|
-
- Copyright (c) 2009 Martin Stannard
|
|
936
|
+
- Copyright (c) 2009-2011 boosty
|
|
937
|
+
- Copyright (c) 2009 ladislav.martincik
|
|
943
938
|
- Copyright (c) 2009-2011 pboling
|
|
944
|
-
- Copyright (c) 2009 Sebastian Roebke
|
|
945
|
-
- Copyright (c) 2009 Tobias Bielohlawek
|
|
946
939
|
- Copyright (c) 2009 XING Engineering
|
|
947
940
|
- Copyright (c) 2010 Joost Baaij
|
|
948
941
|
- Copyright (c) 2010 Joost Baaij
|
|
949
|
-
- Copyright (c) 2010 Ryan Wallace
|
|
950
942
|
- Copyright (c) 2011 Arturas Slajus
|
|
951
943
|
- Copyright (c) 2011 Musy Bite
|
|
952
944
|
- Copyright (c) 2011, 2014 Tim Liner
|
|
953
945
|
- Copyright (c) 2012-2013 David DIDIER
|
|
954
946
|
- Copyright (c) 2012-2015, 2017-2018, 2026 Peter H. Boling
|
|
955
947
|
- Copyright (c) 2012 Tatsuhiko Miyagawa
|
|
956
|
-
- Copyright (c) 2013 Blake Thomson
|
|
957
948
|
- Copyright (c) 2013 Keith Pitty
|
|
958
949
|
- Copyright (c) 2013 Peter M. Goldstein
|
|
959
|
-
- Copyright (c) 2013 Thomas Jachmann
|
|
960
950
|
- Copyright (c) 2014 Alexander Tipugin
|
|
961
951
|
- Copyright (c) 2014, 2017-2018, 2025 Jonathan del Strother
|
|
962
952
|
- Copyright (c) 2015 Ivan
|
|
@@ -991,6 +981,8 @@ To say "thanks!" ☝️ Join the Discord or 👇️ send money.
|
|
|
991
981
|
|
|
992
982
|
### Please give the project a star ⭐ ♥.
|
|
993
983
|
|
|
984
|
+
Many parts of this project are actively managed by a [kettle-jem](https://github.com/structuredmerge/structuredmerge-ruby/tree/main/gems/kettle-jem) smart template utilizing [StructuredMerge.org](https://structuredmerge.org) merge contracts.
|
|
985
|
+
|
|
994
986
|
Thanks for RTFM. ☺️
|
|
995
987
|
|
|
996
988
|
[⛳liberapay-img]: https://img.shields.io/liberapay/goal/pboling.svg?logo=liberapay&color=a51611&style=flat
|
|
@@ -1179,7 +1171,7 @@ Thanks for RTFM. ☺️
|
|
|
1179
1171
|
[📌gitmoji]: https://gitmoji.dev
|
|
1180
1172
|
[📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
|
|
1181
1173
|
[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
|
1182
|
-
[🧮kloc-img]: https://img.shields.io/badge/KLOC-0.
|
|
1174
|
+
[🧮kloc-img]: https://img.shields.io/badge/KLOC-0.454-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
|
|
1183
1175
|
[🔐security]: https://github.com/galtzo-floss/flag_shih_tzu/blob/main/SECURITY.md
|
|
1184
1176
|
[🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
|
|
1185
1177
|
[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
|
@@ -1187,9 +1179,9 @@ Thanks for RTFM. ☺️
|
|
|
1187
1179
|
[📄license-ref]: MIT.md
|
|
1188
1180
|
[📄license-img]: https://img.shields.io/badge/License-MIT-259D6C.svg
|
|
1189
1181
|
[📄license-compat]: https://www.apache.org/legal/resolved.html#category-a
|
|
1190
|
-
[📄license-compat-img]: https://img.shields.io/badge/Apache_Compatible:_Category_A
|
|
1182
|
+
[📄license-compat-img]: https://img.shields.io/badge/Apache_Compatible:_Category_A-%E2%9C%93-259D6C.svg?style=flat&logo=Apache
|
|
1191
1183
|
[🧪fossa]: https://app.fossa.com/projects/git%2Bgithub.com%2Fpboling%2Fflag_shih_tzu?ref=badge_shield
|
|
1192
|
-
[🧪fossa-img]: https://app.fossa.com/api/projects/git
|
|
1184
|
+
[🧪fossa-img]: https://app.fossa.com/api/projects/git+github.com%2Fpboling%2Fflag_shih_tzu.svg?type=shield
|
|
1193
1185
|
[📄ilo-declaration]: https://www.ilo.org/declaration/lang--en/index.htm
|
|
1194
1186
|
[📄ilo-declaration-img]: https://img.shields.io/badge/ILO_Fundamental_Principles-✓-259D6C.svg?style=flat
|
|
1195
1187
|
[🚎yard-current]: http://rubydoc.info/gems/flag_shih_tzu
|
|
@@ -1206,9 +1198,9 @@ Thanks for RTFM. ☺️
|
|
|
1206
1198
|
| Field | Value |
|
|
1207
1199
|
|---|---|
|
|
1208
1200
|
| Package | flag_shih_tzu |
|
|
1209
|
-
| Description | 🏁 Bit
|
|
1201
|
+
| Description | 🏁 Single and Multi-Bit Fields for ActiveRecord:<br>This gem lets you use a single integer column in an ActiveRecord model<br>to store a collection of boolean attributes (flags). Each flag can be used<br>almost in the same way you would use any boolean attribute on an<br>ActiveRecord object. Support for multi-bit fields, like tri-state or enums. |
|
|
1210
1202
|
| Homepage | https://github.com/galtzo-floss/flag_shih_tzu |
|
|
1211
|
-
| Source | https://github.com/galtzo-floss/flag_shih_tzu/tree/
|
|
1203
|
+
| Source | https://github.com/galtzo-floss/flag_shih_tzu/tree/v1.0.1 |
|
|
1212
1204
|
| License | `MIT` |
|
|
1213
|
-
| Funding | https://github.com/sponsors/pboling, https://issuehunt.io/u/pboling, https://ko-fi.com/pboling, https://liberapay.com/pboling/donate, https://patreon.com/galtzo, https://polar.sh/pboling, https://thanks.dev/u/gh/pboling, https://tidelift.com/funding/github/rubygems/flag_shih_tzu, https://www.buymeacoffee.com/pboling |
|
|
1205
|
+
| Funding | https://github.com/sponsors/pboling, https://issuehunt.io/u/pboling, https://ko-fi.com/pboling, https://liberapay.com/pboling/donate, https://opencollective.com/galtzo-floss, https://patreon.com/galtzo, https://polar.sh/pboling, https://thanks.dev/u/gh/pboling, https://tidelift.com/funding/github/rubygems/flag_shih_tzu, https://www.buymeacoffee.com/pboling |
|
|
1214
1206
|
<!-- kettle-jem:metadata:end -->
|
data/SECURITY.md
CHANGED
|
@@ -16,7 +16,7 @@ if defined?(ActiveRecord) && ActiveRecord::VERSION::MAJOR >= 3
|
|
|
16
16
|
module Validations
|
|
17
17
|
# A simple EachValidator that will check for the presence of the flags specified
|
|
18
18
|
class PresenceOfFlagsValidator < EachValidator
|
|
19
|
-
def validate_each(record, attribute,
|
|
19
|
+
def validate_each(record, attribute, _value)
|
|
20
20
|
value = record.send(:read_attribute_for_validation, attribute)
|
|
21
21
|
check_flag(record, attribute)
|
|
22
22
|
|
data/lib/flag_shih_tzu.rb
CHANGED
|
@@ -22,11 +22,11 @@ module FlagShihTzu
|
|
|
22
22
|
"postgresql" => "PostgreSQLAdapter",
|
|
23
23
|
"sqlite" => "SQLite3Adapter",
|
|
24
24
|
"sqlite3" => "SQLite3Adapter",
|
|
25
|
-
"trilogy" => "TrilogyAdapter"
|
|
25
|
+
"trilogy" => "TrilogyAdapter"
|
|
26
26
|
}.freeze
|
|
27
27
|
FLAG_ADAPTER_REQUIRE_NAMES = {
|
|
28
28
|
"mysql" => "mysql2",
|
|
29
|
-
"postgis" => "postgresql"
|
|
29
|
+
"postgis" => "postgresql"
|
|
30
30
|
}.freeze
|
|
31
31
|
FLAG_COLUMN_ONLY_ASSIGNMENT_ADAPTERS = ["jdbcsqlite3", "postgis", "postgresql", "sqlite", "sqlite3"].freeze
|
|
32
32
|
|
|
@@ -200,7 +200,7 @@ module FlagShihTzu
|
|
|
200
200
|
return nil_sql_value(flag_mask) if FlagShihTzu::NIL_VALUES.include?(value)
|
|
201
201
|
|
|
202
202
|
raise InvalidFlagValueException,
|
|
203
|
-
%
|
|
203
|
+
%(Invalid tri-state flag value "#{value.inspect}"; expected true, false, or nil)
|
|
204
204
|
end
|
|
205
205
|
|
|
206
206
|
def low_bit(flag_mask)
|
|
@@ -221,19 +221,19 @@ module FlagShihTzu
|
|
|
221
221
|
check_for_column: FlagShihTzu.default_check_for_column,
|
|
222
222
|
allow_overwrite: false,
|
|
223
223
|
value_mode: nil,
|
|
224
|
-
bit_width: nil
|
|
224
|
+
bit_width: nil
|
|
225
225
|
}.update(opts)
|
|
226
226
|
opts[:value_mode], opts[:bit_width], opts[:encoder] =
|
|
227
227
|
flag_encoder_config(opts[:value_mode], opts[:bit_width], opts[:encoder])
|
|
228
228
|
if !valid_flag_column_name?(opts[:column])
|
|
229
|
-
warn(%
|
|
229
|
+
warn(%(FlagShihTzu says: Please use a String to designate column names! I see you here: #{caller(1..1).first}))
|
|
230
230
|
opts[:column] = opts[:column].to_s
|
|
231
231
|
end
|
|
232
232
|
colmn = opts[:column]
|
|
233
233
|
if opts[:check_for_column] && active_record_class? && !check_flag_column(colmn)
|
|
234
234
|
warn(
|
|
235
|
-
%
|
|
236
|
-
To turn off this warning set check_for_column: false in has_flags definition here: #{caller(1..1).first}
|
|
235
|
+
%(FlagShihTzu says: Flag column #{colmn} appears to be missing!
|
|
236
|
+
To turn off this warning set check_for_column: false in has_flags definition here: #{caller(1..1).first})
|
|
237
237
|
)
|
|
238
238
|
return
|
|
239
239
|
end
|
|
@@ -246,23 +246,23 @@ To turn off this warning set check_for_column: false in has_flags definition her
|
|
|
246
246
|
self.flag_mapping ||= {}
|
|
247
247
|
# If we already have an instance of the same column in the flag_mapping,
|
|
248
248
|
# then there is a double definition on a column
|
|
249
|
-
if opts[:strict] && !
|
|
249
|
+
if opts[:strict] && !flag_mapping[colmn].nil?
|
|
250
250
|
raise DuplicateFlagColumnException
|
|
251
251
|
end
|
|
252
252
|
flag_mapping[colmn] ||= {}
|
|
253
253
|
|
|
254
254
|
# keep track of which flag columns are defined on this class
|
|
255
255
|
self.flag_columns ||= []
|
|
256
|
-
|
|
256
|
+
flag_columns << colmn
|
|
257
257
|
|
|
258
258
|
flag_hash.each do |flag_key, flag_name|
|
|
259
259
|
unless valid_flag_key?(flag_key)
|
|
260
260
|
raise ArgumentError,
|
|
261
|
-
%
|
|
261
|
+
%(has_flags: flag keys should be positive integers, and #{flag_key} is not)
|
|
262
262
|
end
|
|
263
263
|
unless valid_flag_name?(flag_name)
|
|
264
264
|
raise ArgumentError,
|
|
265
|
-
%
|
|
265
|
+
%(has_flags: flag names should be symbols, and #{flag_name} is not)
|
|
266
266
|
end
|
|
267
267
|
flag_mask = opts[:encoder].mask(flag_key)
|
|
268
268
|
# next if method already defined by flag_shih_tzu
|
|
@@ -272,7 +272,7 @@ To turn off this warning set check_for_column: false in has_flags definition her
|
|
|
272
272
|
remove_existing_flag_methods(flag_name)
|
|
273
273
|
else
|
|
274
274
|
raise ArgumentError,
|
|
275
|
-
%
|
|
275
|
+
%(has_flags: flag name #{flag_name} already defined, please choose different name)
|
|
276
276
|
end
|
|
277
277
|
end
|
|
278
278
|
|
|
@@ -491,11 +491,11 @@ To turn off this warning set check_for_column: false in has_flags definition her
|
|
|
491
491
|
def check_flag(flag, colmn)
|
|
492
492
|
unless colmn.is_a?(String)
|
|
493
493
|
raise ArgumentError,
|
|
494
|
-
%
|
|
494
|
+
%(Column name "#{colmn}" for flag "#{flag}" is not a string)
|
|
495
495
|
end
|
|
496
496
|
if flag_mapping[colmn].nil? || !flag_mapping[colmn].include?(flag)
|
|
497
497
|
raise ArgumentError,
|
|
498
|
-
%
|
|
498
|
+
%(Invalid flag "#{flag}")
|
|
499
499
|
end
|
|
500
500
|
end
|
|
501
501
|
|
|
@@ -512,7 +512,7 @@ To turn off this warning set check_for_column: false in has_flags definition her
|
|
|
512
512
|
return colmn if mapping.include?(flag)
|
|
513
513
|
end
|
|
514
514
|
raise NoSuchFlagException.new(
|
|
515
|
-
%
|
|
515
|
+
%(determine_flag_colmn_for: Couldn't determine column for your flags!)
|
|
516
516
|
)
|
|
517
517
|
end
|
|
518
518
|
|
|
@@ -558,17 +558,17 @@ To turn off this warning set check_for_column: false in has_flags definition her
|
|
|
558
558
|
def generated_flag_method_names(flag_name)
|
|
559
559
|
[
|
|
560
560
|
flag_name,
|
|
561
|
-
"#{flag_name}?"
|
|
562
|
-
"#{flag_name}="
|
|
563
|
-
"not_#{flag_name}"
|
|
564
|
-
"not_#{flag_name}?"
|
|
565
|
-
"not_#{flag_name}="
|
|
566
|
-
"#{flag_name}_changed?"
|
|
567
|
-
"#{flag_name}_nil?"
|
|
568
|
-
"saved_change_to_#{flag_name}?"
|
|
569
|
-
"#{flag_name}!"
|
|
570
|
-
"not_#{flag_name}!"
|
|
571
|
-
"clear_#{flag_name}!"
|
|
561
|
+
:"#{flag_name}?",
|
|
562
|
+
:"#{flag_name}=",
|
|
563
|
+
:"not_#{flag_name}",
|
|
564
|
+
:"not_#{flag_name}?",
|
|
565
|
+
:"not_#{flag_name}=",
|
|
566
|
+
:"#{flag_name}_changed?",
|
|
567
|
+
:"#{flag_name}_nil?",
|
|
568
|
+
:"saved_change_to_#{flag_name}?",
|
|
569
|
+
:"#{flag_name}!",
|
|
570
|
+
:"not_#{flag_name}!",
|
|
571
|
+
:"clear_#{flag_name}!"
|
|
572
572
|
]
|
|
573
573
|
end
|
|
574
574
|
|
|
@@ -587,7 +587,7 @@ To turn off this warning set check_for_column: false in has_flags definition her
|
|
|
587
587
|
[:tri_state, TriStateEncoder.bit_width, TriStateEncoder]
|
|
588
588
|
else
|
|
589
589
|
raise ArgumentError,
|
|
590
|
-
%
|
|
590
|
+
%(has_flags: unknown value_mode #{value_mode.inspect})
|
|
591
591
|
end
|
|
592
592
|
end
|
|
593
593
|
|
|
@@ -596,7 +596,7 @@ To turn off this warning set check_for_column: false in has_flags definition her
|
|
|
596
596
|
return [:tri_state, TriStateEncoder.bit_width, TriStateEncoder] if bit_width == TriStateEncoder.bit_width
|
|
597
597
|
|
|
598
598
|
raise ArgumentError,
|
|
599
|
-
%
|
|
599
|
+
%(has_flags: bit_width #{bit_width} requires an encoder)
|
|
600
600
|
end
|
|
601
601
|
|
|
602
602
|
def custom_flag_encoder_config(value_mode, bit_width, encoder)
|
|
@@ -608,7 +608,7 @@ To turn off this warning set check_for_column: false in has_flags definition her
|
|
|
608
608
|
return if bit_width.nil? || bit_width == expected_bit_width
|
|
609
609
|
|
|
610
610
|
raise ArgumentError,
|
|
611
|
-
%
|
|
611
|
+
%(has_flags: value_mode #{value_mode.inspect} requires bit_width #{expected_bit_width})
|
|
612
612
|
end
|
|
613
613
|
|
|
614
614
|
def flag_encoder_for_column(colmn)
|
|
@@ -706,7 +706,7 @@ To turn off this warning set check_for_column: false in has_flags definition her
|
|
|
706
706
|
.select { |key| !key.is_a?(Integer) }
|
|
707
707
|
.each_with_object({}) do |key, hash|
|
|
708
708
|
hash[key] = options.delete(key)
|
|
709
|
-
|
|
709
|
+
end
|
|
710
710
|
end
|
|
711
711
|
[options, add_options]
|
|
712
712
|
end
|
|
@@ -737,19 +737,21 @@ To turn off this warning set check_for_column: false in has_flags definition her
|
|
|
737
737
|
# then we must fail, because flag_shih_tzu will not work
|
|
738
738
|
if found_column.nil?
|
|
739
739
|
warn(
|
|
740
|
-
%
|
|
740
|
+
%(Error: Column "#{colmn}" doesn't exist on table "#{custom_table_name}". Did you forget to run migrations?)
|
|
741
741
|
)
|
|
742
742
|
return false
|
|
743
743
|
elsif found_column.type != :integer
|
|
744
744
|
raise IncorrectFlagColumnException.new(
|
|
745
|
-
%
|
|
745
|
+
%(Table "#{custom_table_name}" must have an integer column named "#{colmn}" in order to use FlagShihTzu.)
|
|
746
746
|
)
|
|
747
747
|
end
|
|
748
748
|
else
|
|
749
749
|
# ActiveRecord gem may not have loaded yet?
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
750
|
+
if has_ar
|
|
751
|
+
warn(
|
|
752
|
+
%(FlagShihTzu#has_flags: Table "#{custom_table_name}" doesn't exist. Have all migrations been run?)
|
|
753
|
+
)
|
|
754
|
+
end
|
|
753
755
|
return false
|
|
754
756
|
end
|
|
755
757
|
|
|
@@ -757,7 +759,7 @@ To turn off this warning set check_for_column: false in has_flags definition her
|
|
|
757
759
|
|
|
758
760
|
# Quietly ignore NoDatabaseErrors - presumably we're being run during, eg, `rails db:create`.
|
|
759
761
|
# NoDatabaseError was only introduced in Rails 4.1, which is why this error-handling is a bit convoluted.
|
|
760
|
-
rescue
|
|
762
|
+
rescue => e
|
|
761
763
|
if defined?(ActiveRecord::NoDatabaseError) && e.is_a?(ActiveRecord::NoDatabaseError)
|
|
762
764
|
true
|
|
763
765
|
else
|
|
@@ -954,8 +956,8 @@ To turn off this warning set check_for_column: false in has_flags definition her
|
|
|
954
956
|
.select { |flag| flags_to_collect.include?(flag) }
|
|
955
957
|
truthy_and_chosen.concat(
|
|
956
958
|
collect_flags(*flags_to_collect) do |memo, flag|
|
|
957
|
-
memo << "not_#{flag}"
|
|
958
|
-
end
|
|
959
|
+
memo << :"not_#{flag}" unless truthy_and_chosen.include?(flag)
|
|
960
|
+
end
|
|
959
961
|
)
|
|
960
962
|
end
|
|
961
963
|
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: flag_shih_tzu
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter Boling
|
|
@@ -50,7 +50,7 @@ dependencies:
|
|
|
50
50
|
version: '1.1'
|
|
51
51
|
- - ">="
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 1.1.
|
|
53
|
+
version: 1.1.11
|
|
54
54
|
type: :runtime
|
|
55
55
|
prerelease: false
|
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -60,27 +60,27 @@ dependencies:
|
|
|
60
60
|
version: '1.1'
|
|
61
61
|
- - ">="
|
|
62
62
|
- !ruby/object:Gem::Version
|
|
63
|
-
version: 1.1.
|
|
63
|
+
version: 1.1.11
|
|
64
64
|
- !ruby/object:Gem::Dependency
|
|
65
65
|
name: kettle-dev
|
|
66
66
|
requirement: !ruby/object:Gem::Requirement
|
|
67
67
|
requirements:
|
|
68
68
|
- - "~>"
|
|
69
69
|
- !ruby/object:Gem::Version
|
|
70
|
-
version: '2.
|
|
70
|
+
version: '2.2'
|
|
71
71
|
- - ">="
|
|
72
72
|
- !ruby/object:Gem::Version
|
|
73
|
-
version: 2.
|
|
73
|
+
version: 2.2.9
|
|
74
74
|
type: :development
|
|
75
75
|
prerelease: false
|
|
76
76
|
version_requirements: !ruby/object:Gem::Requirement
|
|
77
77
|
requirements:
|
|
78
78
|
- - "~>"
|
|
79
79
|
- !ruby/object:Gem::Version
|
|
80
|
-
version: '2.
|
|
80
|
+
version: '2.2'
|
|
81
81
|
- - ">="
|
|
82
82
|
- !ruby/object:Gem::Version
|
|
83
|
-
version: 2.
|
|
83
|
+
version: 2.2.9
|
|
84
84
|
- !ruby/object:Gem::Dependency
|
|
85
85
|
name: bundler-audit
|
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -99,16 +99,16 @@ dependencies:
|
|
|
99
99
|
name: rake
|
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
|
101
101
|
requirements:
|
|
102
|
-
- - "
|
|
102
|
+
- - "~>"
|
|
103
103
|
- !ruby/object:Gem::Version
|
|
104
|
-
version: '0
|
|
104
|
+
version: '13.0'
|
|
105
105
|
type: :development
|
|
106
106
|
prerelease: false
|
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
|
108
108
|
requirements:
|
|
109
|
-
- - "
|
|
109
|
+
- - "~>"
|
|
110
110
|
- !ruby/object:Gem::Version
|
|
111
|
-
version: '0
|
|
111
|
+
version: '13.0'
|
|
112
112
|
- !ruby/object:Gem::Dependency
|
|
113
113
|
name: require_bench
|
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -135,20 +135,20 @@ dependencies:
|
|
|
135
135
|
requirements:
|
|
136
136
|
- - "~>"
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: '3.
|
|
138
|
+
version: '3.1'
|
|
139
139
|
- - ">="
|
|
140
140
|
- !ruby/object:Gem::Version
|
|
141
|
-
version: 3.
|
|
141
|
+
version: 3.1.2
|
|
142
142
|
type: :development
|
|
143
143
|
prerelease: false
|
|
144
144
|
version_requirements: !ruby/object:Gem::Requirement
|
|
145
145
|
requirements:
|
|
146
146
|
- - "~>"
|
|
147
147
|
- !ruby/object:Gem::Version
|
|
148
|
-
version: '3.
|
|
148
|
+
version: '3.1'
|
|
149
149
|
- - ">="
|
|
150
150
|
- !ruby/object:Gem::Version
|
|
151
|
-
version: 3.
|
|
151
|
+
version: 3.1.2
|
|
152
152
|
- !ruby/object:Gem::Dependency
|
|
153
153
|
name: kettle-test
|
|
154
154
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -158,7 +158,7 @@ dependencies:
|
|
|
158
158
|
version: '2.0'
|
|
159
159
|
- - ">="
|
|
160
160
|
- !ruby/object:Gem::Version
|
|
161
|
-
version: 2.0.
|
|
161
|
+
version: 2.0.5
|
|
162
162
|
type: :development
|
|
163
163
|
prerelease: false
|
|
164
164
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -168,43 +168,43 @@ dependencies:
|
|
|
168
168
|
version: '2.0'
|
|
169
169
|
- - ">="
|
|
170
170
|
- !ruby/object:Gem::Version
|
|
171
|
-
version: 2.0.
|
|
171
|
+
version: 2.0.5
|
|
172
172
|
- !ruby/object:Gem::Dependency
|
|
173
|
-
name:
|
|
173
|
+
name: turbo_tests2
|
|
174
174
|
requirement: !ruby/object:Gem::Requirement
|
|
175
175
|
requirements:
|
|
176
176
|
- - "~>"
|
|
177
177
|
- !ruby/object:Gem::Version
|
|
178
|
-
version: '1
|
|
178
|
+
version: '3.1'
|
|
179
|
+
- - ">="
|
|
180
|
+
- !ruby/object:Gem::Version
|
|
181
|
+
version: 3.1.3
|
|
179
182
|
type: :development
|
|
180
183
|
prerelease: false
|
|
181
184
|
version_requirements: !ruby/object:Gem::Requirement
|
|
182
185
|
requirements:
|
|
183
186
|
- - "~>"
|
|
184
187
|
- !ruby/object:Gem::Version
|
|
185
|
-
version: '1
|
|
188
|
+
version: '3.1'
|
|
189
|
+
- - ">="
|
|
190
|
+
- !ruby/object:Gem::Version
|
|
191
|
+
version: 3.1.3
|
|
186
192
|
- !ruby/object:Gem::Dependency
|
|
187
|
-
name:
|
|
193
|
+
name: ruby-progressbar
|
|
188
194
|
requirement: !ruby/object:Gem::Requirement
|
|
189
195
|
requirements:
|
|
190
196
|
- - "~>"
|
|
191
197
|
- !ruby/object:Gem::Version
|
|
192
|
-
version: '1.
|
|
193
|
-
- - ">="
|
|
194
|
-
- !ruby/object:Gem::Version
|
|
195
|
-
version: 1.0.3
|
|
198
|
+
version: '1.13'
|
|
196
199
|
type: :development
|
|
197
200
|
prerelease: false
|
|
198
201
|
version_requirements: !ruby/object:Gem::Requirement
|
|
199
202
|
requirements:
|
|
200
203
|
- - "~>"
|
|
201
204
|
- !ruby/object:Gem::Version
|
|
202
|
-
version: '1.
|
|
203
|
-
- - ">="
|
|
204
|
-
- !ruby/object:Gem::Version
|
|
205
|
-
version: 1.0.3
|
|
205
|
+
version: '1.13'
|
|
206
206
|
- !ruby/object:Gem::Dependency
|
|
207
|
-
name:
|
|
207
|
+
name: stone_checksums
|
|
208
208
|
requirement: !ruby/object:Gem::Requirement
|
|
209
209
|
requirements:
|
|
210
210
|
- - "~>"
|
|
@@ -224,79 +224,30 @@ dependencies:
|
|
|
224
224
|
- !ruby/object:Gem::Version
|
|
225
225
|
version: 1.0.3
|
|
226
226
|
- !ruby/object:Gem::Dependency
|
|
227
|
-
name:
|
|
228
|
-
requirement: !ruby/object:Gem::Requirement
|
|
229
|
-
requirements:
|
|
230
|
-
- - ">="
|
|
231
|
-
- !ruby/object:Gem::Version
|
|
232
|
-
version: '2.2'
|
|
233
|
-
type: :development
|
|
234
|
-
prerelease: false
|
|
235
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
236
|
-
requirements:
|
|
237
|
-
- - ">="
|
|
238
|
-
- !ruby/object:Gem::Version
|
|
239
|
-
version: '2.2'
|
|
240
|
-
- !ruby/object:Gem::Dependency
|
|
241
|
-
name: rspec
|
|
242
|
-
requirement: !ruby/object:Gem::Requirement
|
|
243
|
-
requirements:
|
|
244
|
-
- - "~>"
|
|
245
|
-
- !ruby/object:Gem::Version
|
|
246
|
-
version: '3.0'
|
|
247
|
-
type: :development
|
|
248
|
-
prerelease: false
|
|
249
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
250
|
-
requirements:
|
|
251
|
-
- - "~>"
|
|
252
|
-
- !ruby/object:Gem::Version
|
|
253
|
-
version: '3.0'
|
|
254
|
-
- !ruby/object:Gem::Dependency
|
|
255
|
-
name: rspec_junit_formatter
|
|
227
|
+
name: gitmoji-regex
|
|
256
228
|
requirement: !ruby/object:Gem::Requirement
|
|
257
229
|
requirements:
|
|
258
230
|
- - "~>"
|
|
259
231
|
- !ruby/object:Gem::Version
|
|
260
|
-
version: '0
|
|
261
|
-
type: :development
|
|
262
|
-
prerelease: false
|
|
263
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
264
|
-
requirements:
|
|
265
|
-
- - "~>"
|
|
266
|
-
- !ruby/object:Gem::Version
|
|
267
|
-
version: '0.6'
|
|
268
|
-
- !ruby/object:Gem::Dependency
|
|
269
|
-
name: test-unit
|
|
270
|
-
requirement: !ruby/object:Gem::Requirement
|
|
271
|
-
requirements:
|
|
232
|
+
version: '2.0'
|
|
272
233
|
- - ">="
|
|
273
234
|
- !ruby/object:Gem::Version
|
|
274
|
-
version:
|
|
235
|
+
version: 2.0.2
|
|
275
236
|
type: :development
|
|
276
237
|
prerelease: false
|
|
277
238
|
version_requirements: !ruby/object:Gem::Requirement
|
|
278
239
|
requirements:
|
|
279
|
-
- - "
|
|
280
|
-
- !ruby/object:Gem::Version
|
|
281
|
-
version: '3'
|
|
282
|
-
- !ruby/object:Gem::Dependency
|
|
283
|
-
name: wwtd
|
|
284
|
-
requirement: !ruby/object:Gem::Requirement
|
|
285
|
-
requirements:
|
|
286
|
-
- - ">="
|
|
240
|
+
- - "~>"
|
|
287
241
|
- !ruby/object:Gem::Version
|
|
288
|
-
version: '
|
|
289
|
-
type: :development
|
|
290
|
-
prerelease: false
|
|
291
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
292
|
-
requirements:
|
|
242
|
+
version: '2.0'
|
|
293
243
|
- - ">="
|
|
294
244
|
- !ruby/object:Gem::Version
|
|
295
|
-
version:
|
|
296
|
-
description: "\U0001F3C1 Bit
|
|
297
|
-
integer column in an ActiveRecord model\nto store a collection
|
|
298
|
-
(flags). Each flag can be used\nalmost in the same way you
|
|
299
|
-
attribute on an\nActiveRecord object
|
|
245
|
+
version: 2.0.2
|
|
246
|
+
description: "\U0001F3C1 Single and Multi-Bit Fields for ActiveRecord:\nThis gem lets
|
|
247
|
+
you use a single integer column in an ActiveRecord model\nto store a collection
|
|
248
|
+
of boolean attributes (flags). Each flag can be used\nalmost in the same way you
|
|
249
|
+
would use any boolean attribute on an\nActiveRecord object. Support for multi-bit
|
|
250
|
+
fields, like tri-state or enums.\n"
|
|
300
251
|
email:
|
|
301
252
|
- floss@galtzo.com
|
|
302
253
|
executables: []
|
|
@@ -330,11 +281,11 @@ homepage: https://github.com/galtzo-floss/flag_shih_tzu
|
|
|
330
281
|
licenses:
|
|
331
282
|
- MIT
|
|
332
283
|
metadata:
|
|
333
|
-
homepage_uri: https://
|
|
334
|
-
source_code_uri: https://github.com/galtzo-floss/flag_shih_tzu/tree/v1.0.
|
|
335
|
-
changelog_uri: https://github.com/galtzo-floss/flag_shih_tzu/blob/v1.0.
|
|
284
|
+
homepage_uri: https://flag-shih-tzu.galtzo.com
|
|
285
|
+
source_code_uri: https://github.com/galtzo-floss/flag_shih_tzu/tree/v1.0.2
|
|
286
|
+
changelog_uri: https://github.com/galtzo-floss/flag_shih_tzu/blob/v1.0.2/CHANGELOG.md
|
|
336
287
|
bug_tracker_uri: https://github.com/galtzo-floss/flag_shih_tzu/issues
|
|
337
|
-
documentation_uri: https://www.rubydoc.info/gems/flag_shih_tzu/1.0.
|
|
288
|
+
documentation_uri: https://www.rubydoc.info/gems/flag_shih_tzu/1.0.2
|
|
338
289
|
funding_uri: https://github.com/sponsors/pboling
|
|
339
290
|
wiki_uri: https://github.com/galtzo-floss/flag_shih_tzu/wiki
|
|
340
291
|
news_uri: https://www.railsbling.com/tags/flag_shih_tzu
|
|
@@ -342,7 +293,7 @@ metadata:
|
|
|
342
293
|
rubygems_mfa_required: 'true'
|
|
343
294
|
rdoc_options:
|
|
344
295
|
- "--title"
|
|
345
|
-
- "flag_shih_tzu - \U0001F3C1 Bit
|
|
296
|
+
- "flag_shih_tzu - \U0001F3C1 Single and Multi Bit Fields for ActiveRecord"
|
|
346
297
|
- "--main"
|
|
347
298
|
- README.md
|
|
348
299
|
- "--exclude"
|
|
@@ -365,5 +316,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
365
316
|
requirements: []
|
|
366
317
|
rubygems_version: 4.0.10
|
|
367
318
|
specification_version: 4
|
|
368
|
-
summary: "\U0001F3C1 Bit
|
|
319
|
+
summary: "\U0001F3C1 Single and Multi Bit Fields for ActiveRecord"
|
|
369
320
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|