Project

to_be

0.0
The project is in a healthy, maintained state
Simple Ruby library determining whether strings indicate truey or falsy values.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0.39.5, < 1.0
 Project Readme

to_be.Ruby

Simple Ruby library determining whether strings indicate truey or falsey values.

Language License Gem Version Last Commit Ruby

Table of Contents

  • Introduction
  • Installation
  • Components
  • Terminology
  • Examples
  • Project Information
    • Where to get help
    • Contribution guidelines
    • Dependencies
      • Efferent (fan-out)
        • Runtime Dependencies (aka "Normal Dependencies")
        • Development Dependencies
      • Afferent (fan-in)
        • Runtime dependents
        • Development dependents
    • Related projects
    • License

Introduction

to-be is a library providing facilities for determining the truthiness of strings. It is implemented in several languages: to_be.Ruby is the Ruby implementation.

It has no dependencies on any other non-standard library.

Installation

Install via gem as in:

gem install to_be

or add it to your Gemfile.

Use via require, as in:

require 'to_be'

Components

to_be.Ruby provides:

  • module functions ToBe.string_falsey?, ToBe.string_truey?, and ToBe.string_truthy?;
  • String extensions #falsey?, #truey?, and #truthy? via require 'to_be/extensions/string';

Terminology

The term "truthy" is an unhelpfully overloaded term in the programming world, insofar as it is used to refer to the notion of "truthiness" - 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:

  • "truthy" - whether something can be deemed to be interpretable as having truth;
  • "falsey" - whether an object can be deemed to be interpretable as being false;
  • "truey" - whether an object can be deemed to be interpretable as being true;

For example, consider the following Ruby program:

require 'to_be'

s1 = "no"
s2 = "True"
s3 = "orange"

# "no" is validly truthy, and is falsey
ToBe.string_falsey?(s1) # => true
ToBe.string_truey?(s1) # => false
ToBe.string_truthy?(s1) # => true

# "True" is validly truthy, and is truey
ToBe.string_falsey?(s2) # => false
ToBe.string_truey?(s2) # => true
ToBe.string_truthy?(s2) # => true

# "orange" is not validly truthy, and is neither falsey nor truey
ToBe.string_falsey?(s3) # => false
ToBe.string_truey?(s3) # => false
ToBe.string_truthy?(s3) # => false

and, if extensions are used, the following Ruby program:

require 'to_be/extensions/string'

s1 = "no"
s2 = "True"
s3 = "orange"

# "no" is validly truthy, and is falsey
s1.falsey? # => true
s1.truey? # => false
s1.truthy? # => true

# "True" is validly truthy, and is truey
s2.falsey? # => false
s2.truey? # => true
s2.truthy? # => true

# "orange" is not validly truthy, and is neither falsey nor truey
s3.falsey? # => false
s3.truey? # => false
s3.truthy? # => false

Examples

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.

Project Information

Where to get help

GitHub Page

Contribution guidelines

Defect reports, feature requests, and pull requests are welcome on https://github.com/synesissoftware/to_be.Ruby.

Dependencies

Efferent (fan-out)

Libraries upon which to_be.Ruby depends:

Runtime Dependencies (aka "Normal Dependencies")
  • <none>;
Development Dependencies

Afferent (fan-in)

Projects that depend on to_be.Ruby:

Runtime dependents
  • <none>;
Development dependents
  • <none>;

Related projects

License

to_be.Ruby is released under the 3-clause BSD license. See LICENSE for details.