to_be 0.0.2 → 0.0.4
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
- data/AUTHORS.md +21 -0
- data/CHANGES.md +38 -0
- data/CONTRIBUTING.md +36 -0
- data/EXAMPLES.md +8 -0
- data/FAQ.md +28 -0
- data/INSTALL.md +41 -0
- data/LICENSE +1 -1
- data/NEWS.md +11 -0
- data/README.md +90 -31
- data/Rakefile +6 -4
- data/SECURITY.md +22 -0
- data/TODO.md +23 -0
- data/examples/classify_strings.md +57 -0
- data/examples/classify_strings.rb +27 -0
- data/lib/to_be/extensions/string.rb +1 -1
- data/lib/to_be/internal/_str2bool.rb +1 -0
- data/lib/to_be/truthy.rb +1 -1
- data/lib/to_be/version.rb +4 -4
- data/lib/to_be.rb +1 -1
- metadata +34 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b3fec81616831b28d5872a5e18dde88f0ea15c6a52de5aa5f8e426ff357ee418
|
|
4
|
+
data.tar.gz: 888f7fff8a27b5318cd9e80ecafa9084fe80f78b687e5a75c0a9807955c4e320
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3450f467bbcbba4f47fc9b32ae7bd21aa6b0fc133c17f39cdb992781067584bb963364c582d3a4f15913c6cfc3c701b9403e20398f964838396824a81625dc7c
|
|
7
|
+
data.tar.gz: 9f90cf2967175409ebd4a591eead66a7973f201dc8a1da749e1d9245c095286ea2f091062e7d43fc507f21f9f82a2ec73b7a52af4a92745224bb7a76e53ec095
|
data/AUTHORS.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# to_be.Ruby - Authors <!-- omit in toc -->
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## Major Contributors
|
|
5
|
+
|
|
6
|
+
| Name | GitHub |
|
|
7
|
+
| ----------- | --------------------------------- |
|
|
8
|
+
| Matt Wilson | [mwsis](https://github.com/mwsis) |
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Defect reports, fixes and suggestions (for which we are very grateful)
|
|
12
|
+
|
|
13
|
+
| Name | GitHub |
|
|
14
|
+
| ----------- | --------------------------------- |
|
|
15
|
+
| \<none> | |
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
Contributions are welcomed.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
<!-- ########################### end of file ########################### -->
|
data/CHANGES.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# to_be.Ruby - Changes <!-- omit in toc -->
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## 0.0.4 - 30th August 2026
|
|
5
|
+
|
|
6
|
+
* updated GitHub Actions checkout references to **v7**;
|
|
7
|
+
* corrected shared project URL metadata in **to_be.gemspec**;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 0.0.3 - 20th August 2026
|
|
11
|
+
|
|
12
|
+
* **EXAMPLES.md** example links are repo-relative (`./examples/…`); added **examples/classify_strings**;
|
|
13
|
+
* reordered **README.md** (tagline before badges; TOC after badges), added **Components**, **Examples**, and **Dependencies** (Efferent / Afferent); dropped GitHub-release badge; lexicographically sorted related-project lists;
|
|
14
|
+
* expanded **to_be.gemspec** `spec.summary` to the README tagline; packaged **AUTHORS**, **CHANGES**, **CONTRIBUTING**, **EXAMPLES**, **FAQ**, **INSTALL**, **NEWS**, **SECURITY**, and **TODO**;
|
|
15
|
+
* **to_be.gemspec**: `required_ruby_version` is the range `>= 1.9.3` (dropped `< 4`); **Gemfile.lock** and **.ruby-version** excluded from `spec.files`;
|
|
16
|
+
* stop tracking **Gemfile.lock**; **Gemfile** sets `lockfile false` when Bundler supports it; CI uses `bundler-cache: false` because Bundler 4 then writes no lockfile and **ruby/setup-ruby** cache cats **Gemfile.lock**;
|
|
17
|
+
* CI **Warnings** job now runs on Ruby **3.4**;
|
|
18
|
+
* updated **run_all_unit_tests.sh** (from https://github.com/synesissoftware/misc-dev-scripts) to skip **tput** when **$TERM** is unset or stdout is not a TTY;
|
|
19
|
+
* library source **Home:** URL now uses `https`;
|
|
20
|
+
* **README.md**: Installation before Terminology; Terminology is definitions only (worked examples live in **EXAMPLES.md**); removed duplicated "can be"; **xqsr3** development-dep link is the GitHub project URL;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## 0.0.2 - 1st September 2025
|
|
24
|
+
|
|
25
|
+
* added `# frozen_string_literal: true` to all **lib/** sources;
|
|
26
|
+
* GitHub Actions;
|
|
27
|
+
* added **Rakefile**;
|
|
28
|
+
* badges;
|
|
29
|
+
* **.gitattributes**;
|
|
30
|
+
* updated **run_all_unit_tests.sh** (from https://github.com/synesissoftware/misc-dev-scripts);
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## 0.0.1 - 11th August 2025
|
|
34
|
+
|
|
35
|
+
* initial version;
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
<!-- ########################### end of file ########################### -->
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# to_be.Ruby - Contributing <!-- omit in toc -->
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## Table of Contents <!-- omit in toc -->
|
|
5
|
+
|
|
6
|
+
- [Defects and features](#defects-and-features)
|
|
7
|
+
- [Pull requests](#pull-requests)
|
|
8
|
+
- [Tests](#tests)
|
|
9
|
+
- [License](#license)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Defects and features
|
|
13
|
+
|
|
14
|
+
Open an issue on https://github.com/synesissoftware/to_be.Ruby/issues.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Pull requests
|
|
18
|
+
|
|
19
|
+
Pull requests are welcome on https://github.com/synesissoftware/to_be.Ruby. Keep diffs local to the change; match existing indentation (2 spaces in Ruby) and the Synesis markdown set (**README.md**, **CHANGES.md**, **NEWS.md**, **TODO.md**, **INSTALL.md**, **CONTRIBUTING.md**, **SECURITY.md**).
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Tests
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
bundle exec rake test
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
or `./run_all_unit_tests.sh`.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
Contributions are accepted under the 3-clause BSD license. See [LICENSE](./LICENSE).
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
<!-- ########################### end of file ########################### -->
|
data/EXAMPLES.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# to_be.Ruby - Examples <!-- omit in toc -->
|
|
2
|
+
|
|
3
|
+
|Name|Source & Description|Summary|
|
|
4
|
+
|---|---|---|
|
|
5
|
+
|**classify_strings**|[examples/classify_strings.rb](./examples/classify_strings.rb)<br/>[examples/classify_strings.md](./examples/classify_strings.md)|Classifies sample strings as truthy / truey / falsey via the module API and **String** extensions|
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
<!-- ########################### end of file ########################### -->
|
data/FAQ.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# to_be.Ruby - FAQ <!-- omit in toc -->
|
|
2
|
+
|
|
3
|
+
The FAQ list is under (constant) development. If you post a question on the
|
|
4
|
+
[Issues](https://github.com/synesissoftware/to_be.Ruby/issues) forum
|
|
5
|
+
it will be used to create one.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Table of Contents <!-- omit in toc -->
|
|
9
|
+
|
|
10
|
+
- [Q1: "How do I install this library?"](#q1-how-do-i-install-this-library)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# FAQs: <!-- omit in toc -->
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Q1: "How do I install this library?"
|
|
17
|
+
|
|
18
|
+
Install via **gem**:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
gem install to_be
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
See [README.md](./README.md) for usage.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
<!-- ########################### end of file ########################### -->
|
data/INSTALL.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# to_be.Ruby - Installation and Use <!-- omit in toc -->
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## Table of Contents <!-- omit in toc -->
|
|
5
|
+
|
|
6
|
+
- [Install the gem](#install-the-gem)
|
|
7
|
+
- [From a source checkout](#from-a-source-checkout)
|
|
8
|
+
- [Using the library](#using-the-library)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Install the gem
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
gem install to_be
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
or add to a **Gemfile**:
|
|
18
|
+
|
|
19
|
+
```Ruby
|
|
20
|
+
gem 'to_be'
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
then `bundle install`.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## From a source checkout
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
bundle install
|
|
30
|
+
bundle exec rake test
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## Using the library
|
|
35
|
+
|
|
36
|
+
```Ruby
|
|
37
|
+
require 'to_be'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
<!-- ########################### end of file ########################### -->
|
data/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
to_be.Ruby - BSD 3-Clause License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025, Matthew Wilson and Synesis Information Systems
|
|
3
|
+
Copyright (c) 2025-2026, Matthew Wilson and Synesis Information Systems
|
|
4
4
|
All rights reserved.
|
|
5
5
|
|
|
6
6
|
Redistribution and use in source and binary forms, with or without
|
data/NEWS.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# to_be.Ruby - News <!-- omit in toc -->
|
|
2
|
+
|
|
3
|
+
| Date | News Item |
|
|
4
|
+
| ------------------ | ---------------------------------------------------------------------------------------- |
|
|
5
|
+
| 30th August 2026 | [**to_be.Ruby** 0.0.4](https://github.com/synesissoftware/to_be.Ruby/releases/tag/0.0.4) |
|
|
6
|
+
| 20th August 2026 | [**to_be.Ruby** 0.0.3](https://github.com/synesissoftware/to_be.Ruby/releases/tag/0.0.3) |
|
|
7
|
+
| 1st September 2025 | [**to_be.Ruby** 0.0.2](https://github.com/synesissoftware/to_be.Ruby/releases/tag/0.0.2) |
|
|
8
|
+
| 11th August 2025 | [**to_be.Ruby** 0.0.1](https://github.com/synesissoftware/to_be.Ruby/releases/tag/0.0.1) |
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<!-- ########################### end of file ########################### -->
|
data/README.md
CHANGED
|
@@ -1,36 +1,72 @@
|
|
|
1
1
|
# to_be.Ruby <!-- omit in toc -->
|
|
2
2
|
|
|
3
|
+
Simple Ruby library determining whether strings indicate truey or falsy values.
|
|
4
|
+
|
|
3
5
|

|
|
4
6
|
[](https://opensource.org/licenses/BSD-3-Clause)
|
|
5
|
-
[](https://github.com/synesissoftware/to_be.Ruby/releases/latest)
|
|
6
|
-
[](https://github.com/synesissoftware/to_be.Ruby/commits/master)
|
|
7
7
|
[](https://badge.fury.io/rb/to_be)
|
|
8
|
+
[](https://github.com/synesissoftware/to_be.Ruby/commits/master)
|
|
9
|
+
[](https://github.com/synesissoftware/to_be.Ruby/actions/workflows/ruby.yml)
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
## Table of Contents <!-- omit in toc -->
|
|
13
|
+
|
|
14
|
+
- [Introduction](#introduction)
|
|
15
|
+
- [Installation](#installation)
|
|
16
|
+
- [Components](#components)
|
|
17
|
+
- [Terminology](#terminology)
|
|
18
|
+
- [Examples](#examples)
|
|
19
|
+
- [Project Information](#project-information)
|
|
20
|
+
- [Where to get help](#where-to-get-help)
|
|
21
|
+
- [Contribution guidelines](#contribution-guidelines)
|
|
22
|
+
- [Dependencies](#dependencies)
|
|
23
|
+
- [Efferent (fan-out)](#efferent-fan-out)
|
|
24
|
+
- [Runtime Dependencies (aka "Normal Dependencies")](#runtime-dependencies-aka-normal-dependencies)
|
|
25
|
+
- [Development Dependencies](#development-dependencies)
|
|
26
|
+
- [Afferent (fan-in)](#afferent-fan-in)
|
|
27
|
+
- [Runtime dependents](#runtime-dependents)
|
|
28
|
+
- [Development dependents](#development-dependents)
|
|
29
|
+
- [Related projects](#related-projects)
|
|
30
|
+
- [License](#license)
|
|
10
31
|
|
|
11
32
|
|
|
12
33
|
## Introduction
|
|
13
34
|
|
|
14
|
-
**to-be** is a library providing facilities for
|
|
35
|
+
**to-be** is a library providing facilities for determining the truthyness of strings. It is implemented in several languages: **to_be.Ruby** is the **Ruby** implementation.
|
|
15
36
|
|
|
37
|
+
It has **no dependencies** on any other non-standard library.
|
|
16
38
|
|
|
17
|
-
## Table of Contents <!-- omit in toc -->
|
|
18
39
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
Install via **gem** as in:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
gem install to_be
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
or add it to your `Gemfile`.
|
|
49
|
+
|
|
50
|
+
Use via **require**, as in:
|
|
51
|
+
|
|
52
|
+
```Ruby
|
|
53
|
+
require 'to_be'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## Components
|
|
58
|
+
|
|
59
|
+
**to_be.Ruby** provides:
|
|
60
|
+
|
|
61
|
+
* module functions `ToBe.string_falsey?`, `ToBe.string_truey?`, and `ToBe.string_truthy?`;
|
|
62
|
+
* **String** extensions `#falsey?`, `#truey?`, and `#truthy?` via `require 'to_be/extensions/string'`;
|
|
27
63
|
|
|
28
64
|
|
|
29
65
|
## Terminology
|
|
30
66
|
|
|
31
67
|
The term "*truthy*" is an unhelpfully overloaded term in the programming world, insofar as it is used to refer to the notion of "truthyness" - whether something can be _deemed to be_ interpretable as truth - and also the true side of that interpretation. In this library, the former interpretation is used, leaving us with the following terms:
|
|
32
68
|
|
|
33
|
-
* "*truthy*" - whether something can be
|
|
69
|
+
* "*truthy*" - whether something can be _deemed to be_ interpretable as having truth;
|
|
34
70
|
* "*falsey*" - whether an object can be _deemed to be_ interpretable as being false;
|
|
35
71
|
* "*truey*" - whether an object can be _deemed to be_ interpretable as being true;
|
|
36
72
|
|
|
@@ -85,21 +121,9 @@ s3.truthy? # => false
|
|
|
85
121
|
```
|
|
86
122
|
|
|
87
123
|
|
|
88
|
-
##
|
|
124
|
+
## Examples
|
|
89
125
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
```
|
|
93
|
-
gem install to_be
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
or add it to your `Gemfile`.
|
|
97
|
-
|
|
98
|
-
Use via **require**, as in:
|
|
99
|
-
|
|
100
|
-
```Ruby
|
|
101
|
-
require 'to_be'
|
|
102
|
-
```
|
|
126
|
+
Examples are provided in the ```examples``` directory, along with a markdown description for each. A detailed list TOC of them is provided in [EXAMPLES.md](./EXAMPLES.md).
|
|
103
127
|
|
|
104
128
|
|
|
105
129
|
## Project Information
|
|
@@ -115,17 +139,52 @@ require 'to_be'
|
|
|
115
139
|
Defect reports, feature requests, and pull requests are welcome on https://github.com/synesissoftware/to_be.Ruby.
|
|
116
140
|
|
|
117
141
|
|
|
142
|
+
### Dependencies
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
#### Efferent (fan-out)
|
|
146
|
+
|
|
147
|
+
Libraries upon which **to_be.Ruby** depends:
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
##### Runtime Dependencies (aka "Normal Dependencies")
|
|
151
|
+
|
|
152
|
+
* \<none>;
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
##### Development Dependencies
|
|
156
|
+
|
|
157
|
+
* [**rake**](https://rubygems.org/gems/rake);
|
|
158
|
+
* [**test-unit**](https://rubygems.org/gems/test-unit);
|
|
159
|
+
* [**xqsr3**](https://github.com/synesissoftware/xqsr3);
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
#### Afferent (fan-in)
|
|
163
|
+
|
|
164
|
+
Projects that depend on **to_be.Ruby**:
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
##### Runtime dependents
|
|
168
|
+
|
|
169
|
+
* \<none>;
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
##### Development dependents
|
|
173
|
+
|
|
174
|
+
* \<none>;
|
|
175
|
+
|
|
176
|
+
|
|
118
177
|
### Related projects
|
|
119
178
|
|
|
120
|
-
* [**to-be**](https://github.com/synesissoftware/to-be) (**C**);
|
|
121
179
|
* [**py2be**](https://github.com/synesissoftware/py2be) (**Python**);
|
|
180
|
+
* [**to-be**](https://github.com/synesissoftware/to-be) (**C**);
|
|
181
|
+
* [**to-be.Go**](https://github.com/synesissoftware/to-be.Go);
|
|
122
182
|
* [**to-be.Rust**](https://github.com/synesissoftware/to-be.Rust);
|
|
123
183
|
|
|
124
184
|
|
|
125
185
|
### License
|
|
126
186
|
|
|
127
|
-
**to_be.Ruby** is released under the 3-clause BSD license. See LICENSE for details.
|
|
187
|
+
**to_be.Ruby** is released under the 3-clause BSD license. See [LICENSE](./LICENSE) for details.
|
|
128
188
|
|
|
129
189
|
|
|
130
190
|
<!-- ########################### end of file ########################### -->
|
|
131
|
-
|
data/Rakefile
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Rakefile for to_be.Ruby
|
|
2
4
|
|
|
3
5
|
require 'rake/testtask'
|
|
4
6
|
|
|
5
7
|
|
|
6
8
|
Rake::TestTask.new do |tt|
|
|
7
9
|
|
|
8
|
-
tt.libs <<
|
|
9
|
-
tt.
|
|
10
|
+
tt.libs << 'lib'
|
|
11
|
+
tt.libs << 'test'
|
|
12
|
+
tt.name = 'test'
|
|
10
13
|
tt.test_files = FileList['test/**/tc_*.rb']
|
|
11
14
|
tt.verbose = true
|
|
12
15
|
end
|
|
@@ -16,4 +19,3 @@ task :default => :test
|
|
|
16
19
|
|
|
17
20
|
|
|
18
21
|
# ############################## end of file ############################# #
|
|
19
|
-
|
data/SECURITY.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# to_be.Ruby - Security <!-- omit in toc -->
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## Table of Contents <!-- omit in toc -->
|
|
5
|
+
|
|
6
|
+
- [Reporting a vulnerability](#reporting-a-vulnerability)
|
|
7
|
+
- [Supported versions](#supported-versions)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Reporting a vulnerability
|
|
11
|
+
|
|
12
|
+
Please report security issues privately via GitHub Security Advisories on https://github.com/synesissoftware/to_be.Ruby/security, or by opening an issue if an advisory cannot be filed. Do not attach exploit proofs of concept against third-party systems.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Supported versions
|
|
16
|
+
|
|
17
|
+
| Version | Supported |
|
|
18
|
+
| ------- | --------- |
|
|
19
|
+
| 0.0.x | ✅ |
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
<!-- ########################### end of file ########################### -->
|
data/TODO.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# to_be.Ruby - TODO <!-- omit in toc -->
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## Functional improvements
|
|
5
|
+
|
|
6
|
+
* \<none>
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## Performance improvements
|
|
10
|
+
|
|
11
|
+
* \<none>
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Packaging improvements
|
|
15
|
+
|
|
16
|
+
* [x] ~~~updated **run_all_unit_tests.sh** (from **misc-dev-scripts**) to skip `tput` when `$TERM` is unset or stdout is not a TTY~~~;
|
|
17
|
+
* [x] ~~~**Gemfile** `lockfile false`; stop tracking **Gemfile.lock**; CI `bundler-cache: false`~~~;
|
|
18
|
+
* [x] ~~~gemspec polish: README tagline as `spec.summary`, drop `< 4` upper bound, package docs, exclude **Gemfile.lock** / **.ruby-version**~~~;
|
|
19
|
+
* [x] ~~~README canonical structure (tagline before badges; **Dependencies**; CI badge → **ruby.yml**); added **examples/classify_strings**~~~;
|
|
20
|
+
* [x] ~~~after the packaging/boilerplate/CI baseline: bump **VERSION** and align **CHANGES**/**NEWS**~~~;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<!-- ########################### end of file ########################### -->
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# to_be.Ruby - Example - **classify_strings**
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
Classifies sample strings as truthy, truey, or falsey using the **to_be** module API and the **String** extensions.
|
|
6
|
+
|
|
7
|
+
## Source
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
|
|
11
|
+
#! /usr/bin/env ruby
|
|
12
|
+
|
|
13
|
+
# examples/classify_strings.rb
|
|
14
|
+
|
|
15
|
+
require 'to_be'
|
|
16
|
+
require 'to_be/extensions/string'
|
|
17
|
+
|
|
18
|
+
samples = [
|
|
19
|
+
'no',
|
|
20
|
+
'True',
|
|
21
|
+
'orange',
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
puts 'Module API:'
|
|
25
|
+
samples.each do |s|
|
|
26
|
+
|
|
27
|
+
puts "\t#{s.inspect}\ttruthy=#{ToBe.string_truthy?(s)}\ttruey=#{ToBe.string_truey?(s)}\tfalsey=#{ToBe.string_falsey?(s)}"
|
|
28
|
+
end
|
|
29
|
+
puts
|
|
30
|
+
|
|
31
|
+
puts 'String extensions:'
|
|
32
|
+
samples.each do |s|
|
|
33
|
+
|
|
34
|
+
puts "\t#{s.inspect}\ttruthy=#{s.truthy?}\ttruey=#{s.truey?}\tfalsey=#{s.falsey?}"
|
|
35
|
+
end
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`"no"` is truthy and falsey; `"True"` is truthy and truey; `"orange"` is not classified as truthy.
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
When run, this produces the following output:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
Module API:
|
|
46
|
+
"no" truthy=true truey=false falsey=true
|
|
47
|
+
"True" truthy=true truey=true falsey=false
|
|
48
|
+
"orange" truthy=false truey=false falsey=false
|
|
49
|
+
|
|
50
|
+
String extensions:
|
|
51
|
+
"no" truthy=true truey=false falsey=true
|
|
52
|
+
"True" truthy=true truey=true falsey=false
|
|
53
|
+
"orange" truthy=false truey=false falsey=false
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
<!-- ########################### end of file ########################### -->
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#! /usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
# examples/classify_strings.rb
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
require 'to_be'
|
|
7
|
+
require 'to_be/extensions/string'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
samples = [
|
|
11
|
+
'no',
|
|
12
|
+
'True',
|
|
13
|
+
'orange',
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
puts 'Module API:'
|
|
17
|
+
samples.each do |s|
|
|
18
|
+
|
|
19
|
+
puts "\t#{s.inspect}\ttruthy=#{ToBe.string_truthy?(s)}\ttruey=#{ToBe.string_truey?(s)}\tfalsey=#{ToBe.string_falsey?(s)}"
|
|
20
|
+
end
|
|
21
|
+
puts
|
|
22
|
+
|
|
23
|
+
puts 'String extensions:'
|
|
24
|
+
samples.each do |s|
|
|
25
|
+
|
|
26
|
+
puts "\t#{s.inspect}\ttruthy=#{s.truthy?}\ttruey=#{s.truey?}\tfalsey=#{s.falsey?}"
|
|
27
|
+
end
|
data/lib/to_be/truthy.rb
CHANGED
data/lib/to_be/version.rb
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
# ######################################################################## #
|
|
3
3
|
# File: to_be/version.rb
|
|
4
4
|
#
|
|
5
5
|
# Purpose: Version for ToBe.Ruby library
|
|
6
6
|
#
|
|
7
7
|
# Created: 11th August 2025
|
|
8
|
-
# Updated:
|
|
8
|
+
# Updated: 30th August 2026
|
|
9
9
|
#
|
|
10
|
-
# Home:
|
|
10
|
+
# Home: https://github.com/synesissoftware/to_be.Ruby
|
|
11
11
|
#
|
|
12
12
|
# Author: Matthew Wilson
|
|
13
13
|
#
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
module ToBe
|
|
52
52
|
|
|
53
53
|
# Current version of the ToBe.Ruby library
|
|
54
|
-
VERSION = '0.0.
|
|
54
|
+
VERSION = '0.0.4'
|
|
55
55
|
|
|
56
56
|
private
|
|
57
57
|
# @!visibility private
|
data/lib/to_be.rb
CHANGED
metadata
CHANGED
|
@@ -1,41 +1,58 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: to_be
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matt Wilson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-08-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: xqsr3
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 0.39.5
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '1.0'
|
|
20
23
|
type: :development
|
|
21
24
|
prerelease: false
|
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
26
|
requirements:
|
|
24
|
-
- - "
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: 0.39.5
|
|
30
|
+
- - "<"
|
|
25
31
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '0
|
|
27
|
-
description:
|
|
32
|
+
version: '1.0'
|
|
33
|
+
description: |
|
|
34
|
+
Simple Ruby library determining whether strings indicate truey or falsy
|
|
28
35
|
values.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
email: matthew@synesis.com.au
|
|
36
|
+
email:
|
|
37
|
+
- matthew@synesis.com.au
|
|
32
38
|
executables: []
|
|
33
39
|
extensions: []
|
|
34
40
|
extra_rdoc_files: []
|
|
35
41
|
files:
|
|
42
|
+
- AUTHORS.md
|
|
43
|
+
- CHANGES.md
|
|
44
|
+
- CONTRIBUTING.md
|
|
45
|
+
- EXAMPLES.md
|
|
46
|
+
- FAQ.md
|
|
47
|
+
- INSTALL.md
|
|
36
48
|
- LICENSE
|
|
49
|
+
- NEWS.md
|
|
37
50
|
- README.md
|
|
38
51
|
- Rakefile
|
|
52
|
+
- SECURITY.md
|
|
53
|
+
- TODO.md
|
|
54
|
+
- examples/classify_strings.md
|
|
55
|
+
- examples/classify_strings.rb
|
|
39
56
|
- lib/to_be.rb
|
|
40
57
|
- lib/to_be/extensions/string.rb
|
|
41
58
|
- lib/to_be/internal/_str2bool.rb
|
|
@@ -45,10 +62,14 @@ files:
|
|
|
45
62
|
- test/unit/tc_truthy.rb
|
|
46
63
|
- test/unit/tc_version.rb
|
|
47
64
|
- test/unit/ts_all.rb
|
|
48
|
-
homepage:
|
|
65
|
+
homepage: https://github.com/synesissoftware/to_be.Ruby
|
|
49
66
|
licenses:
|
|
50
67
|
- BSD-3-Clause
|
|
51
|
-
metadata:
|
|
68
|
+
metadata:
|
|
69
|
+
bug_tracker_uri: https://github.com/synesissoftware/to_be.Ruby/issues
|
|
70
|
+
changelog_uri: https://github.com/synesissoftware/to_be.Ruby/blob/master/CHANGES.md
|
|
71
|
+
homepage_uri: https://github.com/synesissoftware/to_be.Ruby
|
|
72
|
+
source_code_uri: https://github.com/synesissoftware/to_be.Ruby
|
|
52
73
|
post_install_message:
|
|
53
74
|
rdoc_options: []
|
|
54
75
|
require_paths:
|
|
@@ -58,9 +79,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
58
79
|
- - ">="
|
|
59
80
|
- !ruby/object:Gem::Version
|
|
60
81
|
version: 1.9.3
|
|
61
|
-
- - "<"
|
|
62
|
-
- !ruby/object:Gem::Version
|
|
63
|
-
version: '4'
|
|
64
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
83
|
requirements:
|
|
66
84
|
- - ">="
|
|
@@ -71,5 +89,5 @@ rubyforge_project:
|
|
|
71
89
|
rubygems_version: 2.7.6.3
|
|
72
90
|
signing_key:
|
|
73
91
|
specification_version: 4
|
|
74
|
-
summary:
|
|
92
|
+
summary: Simple Ruby library determining whether strings indicate truey or falsy values.
|
|
75
93
|
test_files: []
|