Class: NilClass

Inherits:
Object show all
Defined in:
lib/corelib_ruby/core_ext/nil/core.rb

Instance Method Summary collapse

Instance Method Details

#cl_combine(*args) ⇒ Object

See the documenation for String#cl_combine. This method exists so we can seamlessly call nil.cl_combine(“foo”) and get back “foo” (instead of an error).



14
15
16
# File 'lib/corelib_ruby/core_ext/nil/core.rb', line 14

def cl_combine(*args)
  "".cl_combine(*args)
end

#cl_not_nil?Boolean

A simple helper to improve readability. [].cl_not_nil? reads better than ![].nil?

Returns:

  • (Boolean)


4
5
6
# File 'lib/corelib_ruby/core_ext/nil/core.rb', line 4

def cl_not_nil?
  false
end

#cl_to_yes_no(options = {}) ⇒ Object



8
9
10
# File 'lib/corelib_ruby/core_ext/nil/core.rb', line 8

def cl_to_yes_no(options={})
  options.fetch(:if_nil, "")
end