Core Extensions
# File lib/core/facets/blank.rb, line 20
20: def blank?
21: true
22: end
# File lib/core/facets/duplicable.rb, line 10
10: def clone? ; false ; end
# File lib/core/facets/duplicable.rb, line 9 9: def dup? ; false ; 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
36: def ergo
37: @_ergo ||= Functor.new{ nil }
38: @_ergo unless block_given?
39: end
# File lib/core/facets/boolean.rb, line 81
81: def to_bool
82: false
83: end
Allows nil to respond to #. Always returns 0.
nil.to_f #=> 0.0
CREDIT: Matz
# File lib/core/facets/nilclass/to_f.rb, line 12
12: def to_f; 0.0; end
Allows nil to create an empty hash, similar to # and #.
nil.to_h #=> {}
CREDIT: Trans
# File lib/core/facets/to_hash.rb, line 264
264: def to_h; {}; end
Nil converts to an empty OpenObject.
# File lib/more/facets/openobject.rb, line 233
233: def to_openobject
234: OpenObject.new
235: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.