class String
Public Instance Methods
to_b(when_not_recognized=:raise)
click to toggle source
# File lib/truther.rb, line 15 def to_b(when_not_recognized=:raise) sanitized_string = self.downcase.strip return true if Truther::TRUTHY_STRINGS.include? sanitized_string return false if Truther::FALSY_STRINGS.include? sanitized_string if when_not_recognized == :raise raise Truther::NeitherTrueNorFalseError.new sanitized_string else when_not_recognized end end