Module: Tins::Null
Overview
Implementation of the null object pattern in Ruby.
Defined Under Namespace
Modules: Kernel
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing ⇒ Object
4
5
6
|
# File 'lib/tins/null.rb', line 4
def method_missing(*)
self
end
|
Instance Method Details
52
53
|
# File 'lib/tins/null.rb', line 52
def as_json(*)
end
|
#blank? ⇒ Boolean
48
49
50
|
# File 'lib/tins/null.rb', line 48
def blank?
true
end
|
#const_missing ⇒ Object
8
9
10
|
# File 'lib/tins/null.rb', line 8
def const_missing(*)
self
end
|
40
41
42
|
# File 'lib/tins/null.rb', line 40
def inspect
'NULL'
end
|
#nil? ⇒ Boolean
44
45
46
|
# File 'lib/tins/null.rb', line 44
def nil?
true
end
|
32
33
34
|
# File 'lib/tins/null.rb', line 32
def to_a
[]
end
|
36
37
38
|
# File 'lib/tins/null.rb', line 36
def to_ary
nil
end
|
20
21
22
|
# File 'lib/tins/null.rb', line 20
def to_f
0.0
end
|
24
25
26
|
# File 'lib/tins/null.rb', line 24
def to_i
0
end
|
28
29
30
|
# File 'lib/tins/null.rb', line 28
def to_int
nil
end
|
55
56
57
|
# File 'lib/tins/null.rb', line 55
def to_json(*)
'null'
end
|
12
13
14
|
# File 'lib/tins/null.rb', line 12
def to_s
''
end
|
16
17
18
|
# File 'lib/tins/null.rb', line 16
def to_str
nil
end
|