Module: ToBe

Defined in:
lib/to_be.rb,
lib/to_be/truthy.rb,
lib/to_be/version.rb,
lib/to_be/internal/_str2bool.rb

Defined Under Namespace

Modules: Internal

Constant Summary collapse

VERSION =

Current version of the ToBe.Ruby library

'0.0.2'
VERSION_MAJOR =

Major version of the ToBe.Ruby library

VERSION_PARTS_[0]
VERSION_MINOR =

Minor version of the ToBe.Ruby library

VERSION_PARTS_[1]
VERSION_REVISION =

Revision version of the ToBe.Ruby library

VERSION_PARTS_[2]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.string_falsey?(s) ⇒ Boolean

Indicates that the given string, when trimmed, is classified as “truthy” and is deemed as “falsey”.

Returns:

  • (Boolean)


24
25
26
27
# File 'lib/to_be/truthy.rb', line 24

def string_falsey? s

  return false == ToBe::Internal::_str2bool(s)
end

.string_truey?(s) ⇒ Boolean

Indicates that the given string, when trimmed, is classified as “truthy” and is deemed as “truey”.

Returns:

  • (Boolean)


31
32
33
34
# File 'lib/to_be/truthy.rb', line 31

def string_truey? s

  return true == ToBe::Internal::_str2bool(s)
end

.string_truthy?(s) ⇒ Boolean

Indicates that the given string, when trimmed, is classified as “truthy” (and is deemed as either “falsey” or “truey”).

Returns:

  • (Boolean)


38
39
40
41
# File 'lib/to_be/truthy.rb', line 38

def string_truthy? s

  return !ToBe::Internal::_str2bool(s).nil?
end

Instance Method Details

#str2bool(s) ⇒ Object

Determines the “truthy” nature of whether the given string is “truthy” and, if so, whether it is “falsey” or “truey”.

Returns:

  • ‘None` - string is not classified as “truthy”;

  • ‘False` - string is classified as “truthy” and is deemed “falsey”;

  • ‘True` - string is classified as “truthy” and is deemed “truey”;



17
18
19
20
# File 'lib/to_be/truthy.rb', line 17

def str2bool s

  ToBe::Internal::_str2bool s
end