Class: NilClass
Overview
Define some built-in Inform helper methods
Instance Method Summary
collapse
#list_together, #object?, #sysobj?
#in?
Methods included from Enumerable
#inform
#in?, #notin?
Instance Method Details
66
67
68
69
70
71
72
73
|
# File 'lib/runtime/mixins.rb', line 66
def +(other)
case other
when String then format(JoinedTemplate, str: self.to_s, other: other.to_s)
when Integer then 0 + other
when Enumerable then [] + other
else format(JoinedTemplate, str: self.to_s, other: other.to_s)
end
end
|
75
76
77
78
79
80
81
82
|
# File 'lib/runtime/mixins.rb', line 75
def -(other)
case other
when String then self.to_s.delete other
when Integer then 0 - other
when Enumerable then [] - other
else self.to_s.delete other
end
end
|
#<(other, default = false) ⇒ Object
100
101
102
103
104
105
106
|
# File 'lib/runtime/mixins.rb', line 100
def <(other, default = false)
other > 0
rescue StandardError => _e
default
end
|
#<=(other, default = false) ⇒ Object
108
109
110
111
112
113
114
|
# File 'lib/runtime/mixins.rb', line 108
def <=(other, default = false)
other >= 0
rescue StandardError => _e
default
end
|
#>(other, default = false) ⇒ Object
84
85
86
87
88
89
90
|
# File 'lib/runtime/mixins.rb', line 84
def >(other, default = false)
other < 0
rescue StandardError => _e
default
end
|
#>=(other, default = false) ⇒ Object
92
93
94
95
96
97
98
|
# File 'lib/runtime/mixins.rb', line 92
def >=(other, default = false)
other <= 0
rescue StandardError => _e
default
end
|
Incompatible with RubyUnits::Unit#to_base def *(other)
0 * other
return self unless other.respond_to? __method__
0.send(__method__, other) rescue self
end
135
136
137
|
# File 'lib/runtime/mixins.rb', line 135
def [](_key)
self
end
|
#[]=(_key, _value) ⇒ Object
139
140
141
|
# File 'lib/runtime/mixins.rb', line 139
def []=(_key, _value)
self
end
|
#each(*_args, &_block) ⇒ Object
170
171
172
|
# File 'lib/runtime/mixins.rb', line 170
def each(*_args, &_block)
return end
|
#empty? ⇒ Boolean
164
165
166
|
# File 'lib/runtime/mixins.rb', line 164
def empty?
true
end
|
174
175
176
|
# File 'lib/runtime/mixins.rb', line 174
def join(s)
[].join(s)
end
|
178
179
180
|
# File 'lib/runtime/mixins.rb', line 178
def refresh
self
end
|
143
144
145
|
# File 'lib/runtime/mixins.rb', line 143
def to_ary
[]
end
|
151
152
153
|
# File 'lib/runtime/mixins.rb', line 151
def to_f
0.0
end
|
147
148
149
|
# File 'lib/runtime/mixins.rb', line 147
def to_i
0
end
|
155
156
157
|
# File 'lib/runtime/mixins.rb', line 155
def to_str
self.to_s
end
|
#to_sym ⇒ Object
Also known as:
intern
159
160
161
|
# File 'lib/runtime/mixins.rb', line 159
def to_sym
self
end
|