Module: Null
- Included in:
- Object
- Defined in:
- lib/nullobject.rb
Defined Under Namespace
Classes: Object
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*_args, &_block) ⇒ Object
36
37
38
|
# File 'lib/nullobject.rb', line 36
def method_missing(*_args, &_block)
self
end
|
Class Method Details
.included(base) ⇒ Object
4
5
6
|
# File 'lib/nullobject.rb', line 4
def self.included(base)
base.send(:include, Singleton)
end
|
Instance Method Details
32
33
34
|
# File 'lib/nullobject.rb', line 32
def inspect
format("#<%s:0x%x>", self.class, object_id)
end
|
#nil? ⇒ Boolean
28
29
30
|
# File 'lib/nullobject.rb', line 28
def nil?
true
end
|
#respond_to?(_message, _include_private = false) ⇒ Boolean
40
41
42
|
# File 'lib/nullobject.rb', line 40
def respond_to?(_message, _include_private = false)
true
end
|
8
9
10
|
# File 'lib/nullobject.rb', line 8
def to_a
[]
end
|
12
13
14
|
# File 'lib/nullobject.rb', line 12
def to_ary
[]
end
|
20
21
22
|
# File 'lib/nullobject.rb', line 20
def to_f
0.0
end
|
24
25
26
|
# File 'lib/nullobject.rb', line 24
def to_i
0
end
|
16
17
18
|
# File 'lib/nullobject.rb', line 16
def to_s
""
end
|