Methods
blank?
ergo
to_bool
to_f
to_h
Public Instance methods
[ + ]
# File lib/core/facets/blank.rb, line 20 def blank? true end
Compliments Kernel#ergo.
"a".ergo{ |o| o.upcase } #=> "A" nil.ergo{ |o| o.bar } #=> nil
CREDIT: Daniel DeLorme
[ + ]
# File lib/core/facets/kernel/ergo.rb, line 36 def ergo @_ergo ||= Functor.new{ nil } @_ergo unless block_given? end
[ + ]
# File lib/core/facets/boolean.rb, line 153 def to_bool false end
[ + ]
# File lib/core/facets/nilclass/to_f.rb, line 12 def to_f; 0.0; end
Allows nil to create an empty hash, similar to to_a and to_s.
nil.to_h #=> {}
CREDIT: Trans
[ + ]
# File lib/core/facets/to_hash.rb, line 284 def to_h; {}; end