Class: Dhall::Bool
Instance Method Summary
collapse
Methods inherited from Expression
#*, #+, #<<, #as_dhall, #cache_key, #call, #concat, decode, #deep_merge, #deep_merge_type, #digest, #fetch, #fusion, #merge, #normalize, #resolve, #shift, #slice, #substitute, #to_cbor, #to_proc
Instance Method Details
#!@ ⇒ Object
222
223
224
|
# File 'lib/dhall/ast.rb', line 222
def !@
with(value: !value)
end
|
#&(other) ⇒ Object
206
207
208
|
# File 'lib/dhall/ast.rb', line 206
def &(other)
reduce(other, with(value: false))
end
|
#===(other) ⇒ Object
226
227
228
|
# File 'lib/dhall/ast.rb', line 226
def ===(other)
self == other || value === other
end
|
#as_json ⇒ Object
234
235
236
|
# File 'lib/dhall/ast.rb', line 234
def as_json
value
end
|
#dhall_eq(other) ⇒ Object
214
215
216
217
218
219
220
|
# File 'lib/dhall/ast.rb', line 214
def dhall_eq(other)
if other.is_a?(Bool)
reduce(other, with(value: self == other))
else
reduce(other, super)
end
end
|
#reduce(when_true, when_false) ⇒ Object
202
203
204
|
# File 'lib/dhall/ast.rb', line 202
def reduce(when_true, when_false)
value ? when_true : when_false
end
|
#to_s ⇒ Object
230
231
232
|
# File 'lib/dhall/ast.rb', line 230
def to_s
reduce("True", "False")
end
|
#|(other) ⇒ Object
210
211
212
|
# File 'lib/dhall/ast.rb', line 210
def |(other)
reduce(with(value: true), other)
end
|