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
15
16
17
|
# File 'lib/nullobject.rb', line 15
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
#nil? ⇒ Boolean
13
|
# File 'lib/nullobject.rb', line 13
def nil?; true; end
|
9
|
# File 'lib/nullobject.rb', line 9
def to_a; []; end
|
11
|
# File 'lib/nullobject.rb', line 11
def to_f; 0.0; end
|
12
|
# File 'lib/nullobject.rb', line 12
def to_i; 0; end
|
10
|
# File 'lib/nullobject.rb', line 10
def to_s; ""; end
|