# frozen_string_literal: true

# @see https://gist.github.com/equivalent/3825916#gistcomment-1762089
module ToBoolean
  def to_bool
    ActiveRecord::Type::Boolean.new.cast(self)
  end
end

class NilClass; include ToBoolean; end

class TrueClass; include ToBoolean; end

class FalseClass; include ToBoolean; end

class Numeric; include ToBoolean; end

class String; include ToBoolean; end
