Class: Dhall::EmptyList
- Inherits:
-
List
show all
- Defined in:
- lib/dhall/ast.rb,
lib/dhall/binary.rb,
lib/dhall/normalize.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from List
as_dhall, #element_type, of
Methods inherited from Expression
#&, #*, #+, #as_dhall, #cache_key, #call, #deep_merge, #deep_merge_type, #dhall_eq, #digest, #fetch, #fusion, #merge, #resolve, #shift, #slice, #substitute, #to_binary, #to_cbor, #to_proc, #to_s, #|
Constructor Details
#initialize(attrs) ⇒ EmptyList
Returns a new instance of EmptyList.
469
470
471
472
473
474
475
476
|
# File 'lib/dhall/ast.rb', line 469
def initialize(attrs)
if attrs.key?(:element_type)
et = attrs.delete(:element_type)
attrs[:type] = self.class.as_dhall.call(et) if et
end
super
end
|
Instance Method Details
#[](_) ⇒ Object
500
501
502
|
# File 'lib/dhall/ast.rb', line 500
def [](_)
OptionalNone.new(value_type: element_type)
end
|
#as_json ⇒ Object
478
479
480
481
482
|
# File 'lib/dhall/ast.rb', line 478
def as_json
[4, element_type.as_json]
rescue
[28, type.as_json]
end
|
#concat(other) ⇒ Object
520
521
522
|
# File 'lib/dhall/ast.rb', line 520
def concat(other)
other
end
|
#each ⇒ Object
488
489
490
|
# File 'lib/dhall/ast.rb', line 488
def each
self
end
|
#first ⇒ Object
504
505
506
|
# File 'lib/dhall/ast.rb', line 504
def first
OptionalNone.new(value_type: element_type)
end
|
#join ⇒ Object
516
517
518
|
# File 'lib/dhall/ast.rb', line 516
def join(*)
""
end
|
#last ⇒ Object
508
509
510
|
# File 'lib/dhall/ast.rb', line 508
def last
OptionalNone.new(value_type: element_type)
end
|
#length ⇒ Object
496
497
498
|
# File 'lib/dhall/ast.rb', line 496
def length
0
end
|
#map(type: nil) ⇒ Object
484
485
486
|
# File 'lib/dhall/ast.rb', line 484
def map(type: nil)
type.nil? ? self : with(element_type: type)
end
|
#normalize ⇒ Object
247
248
249
|
# File 'lib/dhall/normalize.rb', line 247
def normalize
super.with(type: type.normalize)
end
|
#reduce(z) ⇒ Object
492
493
494
|
# File 'lib/dhall/ast.rb', line 492
def reduce(z)
z
end
|
#reverse ⇒ Object
512
513
514
|
# File 'lib/dhall/ast.rb', line 512
def reverse
self
end
|