Class: NilClass
- Inherits:
-
Object
show all
- 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
Constant Summary
collapse
- WHINERS =
[::Array]
- @@method_class_map =
Hash.new
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
26
27
28
|
# File 'lib/active_support/whiny_nil.rb', line 26
def method_missing(method, *args, &block)
raise_nil_warning_for @@method_class_map[method], method, caller
end
|
Instance Method Details
#blank? ⇒ Boolean
15
16
17
|
# File 'lib/active_support/core_ext/blank.rb', line 15
def blank?
true
end
|
#duplicable? ⇒ Boolean
10
11
12
|
# File 'lib/active_support/core_ext/duplicable.rb', line 10
def duplicable?
false
end
|
21
22
23
|
# File 'lib/active_support/whiny_nil.rb', line 21
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
2
3
4
|
# File 'lib/active_support/json/encoders/nil_class.rb', line 2
def to_json(options = nil) 'null'
end
|