# frozen_string_literal: true require 'forwardable' TrueClass.class_eval do unless method_defined?(:to_bool) # :nodoc: def to_bool true end end end FalseClass.class_eval do unless method_defined?(:to_bool) # :nodoc: def to_bool false end end end NilClass.class_eval do unless method_defined?(:to_bool) # :nodoc: def to_bool false end end end String.class_eval do unless method_defined?(:to_bool) # :nodoc: def to_bool match?(/^(true|1|t|y|yes)$/i) end end end Numeric.class_eval do unless method_defined?(:to_bool) extend Forwardable def_delegators :to_s, :to_bool end end