Parent

NilClass

Public Instance Methods

blank?() click to toggle source
# File lib/core/facets/kernel/blank.rb, line 44
def blank?
  true
end
clone?() click to toggle source
# File lib/core/facets/object/dup.rb, line 34
def clone? ; false ; end
dup!() click to toggle source

Since NilClass is immutable it cannot be duplicated. For this reason try_dup returns self.

nil.dup!  #=> nil
# File lib/core/facets/object/dup.rb, line 32
def dup!   ; self  ; end
dup?() click to toggle source
# File lib/core/facets/object/dup.rb, line 33
def dup?   ; false ; end
ergo() click to toggle source

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 37
def ergo
  @_ergo ||= Functor.new{ nil }
  @_ergo unless block_given?
end
to_bool() click to toggle source
# File lib/core/facets/boolean.rb, line 51
def to_bool
  false
end
to_f() click to toggle source

Allows nil to respond to to_f. Always returns 0.

nil.to_f   #=> 0.0

CREDIT: Matz

# File lib/core/facets/nilclass/to_f.rb, line 12
def to_f; 0.0; end
to_h() click to toggle source

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 268
def to_h; {}; end
to_ostruct() click to toggle source

Create an empty OpenStruct object.

# File lib/standard/facets/ostruct.rb, line 205
def to_ostruct
  OpenStruct.new
end
to_path() click to toggle source

Provide platform dependent null path.

@standard

require 'facets/pathname'

@author Daniel Burger

# File lib/standard/facets/pathname.rb, line 239
def to_path
  Pathname.null
end
try(method=nil, *args) click to toggle source

See Kernel#try.

# File lib/core/facets/kernel/try.rb, line 49
def try(method=nil, *args)
  if method
    nil
  else
    Functor.new{ nil }
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.