Sha256: 464e51b8a86b6d10508b74a0ae3784b060294c6bdd046aa983c7bdf08d0424cf
Contents?: true
Size: 586 Bytes
Versions: 3
Compression:
Stored size: 586 Bytes
Contents
# encoding: utf-8 module Mixture module Coerce # Handles coercion of the Nil class. class Nil < Base type Types::Nil coerce_to(Types::Object, Itself) coerce_to(Types::Nil, Itself) coerce_to(Types::Boolean, Refute) coerce_to(Types::String) { "" } coerce_to(Types::Array) { [] } coerce_to(Types::Float) { 0.0 } coerce_to(Types::Hash) { {} } coerce_to(Types::Integer) { 0 } coerce_to(Types::Rational) { Rational(0, 1) } coerce_to(Types::Set) { Set.new } coerce_to(Types::Symbol) { :"" } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mixture-0.6.2 | lib/mixture/coerce/nil.rb |
mixture-0.6.1 | lib/mixture/coerce/nil.rb |
mixture-0.6.0 | lib/mixture/coerce/nil.rb |