Module: WannabeBool::String
Constant Summary collapse
- TRUES =
%W{t true on y yes 1}.freeze
- FALSES =
%W{f false off n no 0}.freeze
Instance Method Summary collapse
Methods included from Aliasing
Instance Method Details
#to_b ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/wannabe_bool/string.rb', line 6 def to_b value = self.strip.downcase return true if TRUES.include?(value) return false if FALSES.include?(value) WannabeBool.invalid_value_behaviour.call end |