Class: NullObject
- Inherits:
-
Object
show all
- Defined in:
- lib/maybe_null/null_object.rb
Overview
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ NullObject
7
8
9
|
# File 'lib/maybe_null/null_object.rb', line 7
def method_missing(*args, &block)
self
end
|
Instance Method Details
#==(other) ⇒ Object
53
54
55
|
# File 'lib/maybe_null/null_object.rb', line 53
def ==(other)
other.is_a?(self.class)
end
|
#blank? ⇒ Boolean
19
20
21
|
# File 'lib/maybe_null/null_object.rb', line 19
def blank?
true
end
|
#nil? ⇒ Boolean
15
16
17
|
# File 'lib/maybe_null/null_object.rb', line 15
def nil?
true
end
|
#presence ⇒ NilClass
28
29
30
|
# File 'lib/maybe_null/null_object.rb', line 28
def presence
nil
end
|
#present? ⇒ Boolean
23
24
25
|
# File 'lib/maybe_null/null_object.rb', line 23
def present?
false
end
|
#respond_to?(*args) ⇒ Boolean
11
12
13
|
# File 'lib/maybe_null/null_object.rb', line 11
def respond_to?(*args)
true
end
|
#to_a ⇒ Array
33
|
# File 'lib/maybe_null/null_object.rb', line 33
def to_a; [] end
|
#to_boolean ⇒ Boolean
48
|
# File 'lib/maybe_null/null_object.rb', line 48
def to_boolean; false end
|
#to_f ⇒ Float
39
|
# File 'lib/maybe_null/null_object.rb', line 39
def to_f; 0.0 end
|
#to_hash ⇒ Hash
51
|
# File 'lib/maybe_null/null_object.rb', line 51
def to_hash; {} end
|
#to_i ⇒ Integer
42
|
# File 'lib/maybe_null/null_object.rb', line 42
def to_i; 0 end
|
#to_int ⇒ Integer
45
|
# File 'lib/maybe_null/null_object.rb', line 45
def to_int; 0 end
|
#to_s ⇒ String
36
|
# File 'lib/maybe_null/null_object.rb', line 36
def to_s; "" end
|