Module: ToBe::Internal

Defined in:
lib/to_be/internal/_str2bool.rb

Defined Under Namespace

Modules: Constants_

Class Method Summary collapse

Class Method Details

._str2bool(s) ⇒ Object

module Constants_



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/to_be/internal/_str2bool.rb', line 53

def self._str2bool s

  return nil if s.nil?

  return true if Constants_::TRUEY_PRECISE_STRINGS.include? s

  return false if Constants_::FALSEY_PRECISE_STRINGS.include? s

  s = s.strip.downcase

  return true if Constants_::TRUEY_LOWERCASE_STRINGS.include? s

  return false if Constants_::FALSEY_LOWERCASE_STRINGS.include? s

  nil
end