Top Level Namespace

Defined Under Namespace

Modules: ActiveSupport, Boolean, Enumerable, Rails, Ripple Classes: Date, DateTime, Float, Integer, Numeric, Object, RippleGenerator, Set, String, Symbol, Time

Constant Summary collapse

BooleanCast =
Module.new do
  def ripple_cast(value)
    case value
    when NilClass
      nil
    when Numeric
      !value.zero?
    when TrueClass, FalseClass
      value
    when /^\s*0/
      false
    when /^\s*t/i
      true
    when /^\s*f/i
      false
    else
      value.present?
    end
  end
end