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
20
21
22
|
# File 'lib/nullobject.rb', line 20
def method_missing(*args, &block)
self
end
|
Class Method Details
.included(base) ⇒ Object
5
6
7
|
# File 'lib/nullobject.rb', line 5
def self.included(base)
base.send(:include, Singleton)
end
|
Instance Method Details
16
17
18
|
# File 'lib/nullobject.rb', line 16
def inspect
"#<%s:0x%x>" % [self.class, object_id]
end
|
#nil? ⇒ Boolean
14
|
# File 'lib/nullobject.rb', line 14
def nil?; true; end
|
#respond_to?(message, include_private = false) ⇒ Boolean
24
25
26
|
# File 'lib/nullobject.rb', line 24
def respond_to?(message, include_private=false)
true
end
|
9
|
# File 'lib/nullobject.rb', line 9
def to_a; []; end
|
10
|
# File 'lib/nullobject.rb', line 10
def to_ary; []; end
|
12
|
# File 'lib/nullobject.rb', line 12
def to_f; 0.0; end
|
13
|
# File 'lib/nullobject.rb', line 13
def to_i; 0; end
|
11
|
# File 'lib/nullobject.rb', line 11
def to_s; ""; end
|