Class: NilClass
- Defined in:
- lib/active_support/whiny_nil.rb,
lib/active_support/core_ext/blank.rb,
lib/active_support/core_ext/duplicable.rb,
lib/active_support/json/encoders/nil_class.rb
Overview
:nodoc:
Constant Summary collapse
Instance Method Summary collapse
- #blank? ⇒ Boolean
- #duplicable? ⇒ Boolean
-
#id ⇒ Object
Raises a RuntimeError when you attempt to call
id
onnil
. -
#to_json(options = nil) ⇒ Object
:nodoc:.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
45 46 47 |
# File 'lib/active_support/whiny_nil.rb', line 45 def method_missing(method, *args, &block) raise_nil_warning_for METHOD_CLASS_MAP[method], method, caller end |
Instance Method Details
#blank? ⇒ Boolean
23 24 25 |
# File 'lib/active_support/core_ext/blank.rb', line 23 def blank? true end |
#duplicable? ⇒ Boolean
10 11 12 |
# File 'lib/active_support/core_ext/duplicable.rb', line 10 def duplicable? false end |
#id ⇒ Object
Raises a RuntimeError when you attempt to call id
on nil
.
40 41 42 |
# File 'lib/active_support/whiny_nil.rb', line 40 def id raise RuntimeError, "Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id", caller end |
#to_json(options = nil) ⇒ Object
:nodoc:
2 3 4 |
# File 'lib/active_support/json/encoders/nil_class.rb', line 2 def to_json( = nil) #:nodoc: 'null' end |