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
#&, #*, #+, #annotate, #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.
510
511
512
513
514
515
516
517
|
# File 'lib/dhall/ast.rb', line 510
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
541
542
543
|
# File 'lib/dhall/ast.rb', line 541
def [](_)
OptionalNone.new(value_type: element_type)
end
|
#as_json ⇒ Object
519
520
521
522
523
|
# File 'lib/dhall/ast.rb', line 519
def as_json
[4, element_type.as_json]
rescue
[28, type.as_json]
end
|
#concat(other) ⇒ Object
561
562
563
|
# File 'lib/dhall/ast.rb', line 561
def concat(other)
other
end
|
#each ⇒ Object
529
530
531
|
# File 'lib/dhall/ast.rb', line 529
def each
self
end
|
#first ⇒ Object
545
546
547
|
# File 'lib/dhall/ast.rb', line 545
def first
OptionalNone.new(value_type: element_type)
end
|
#join ⇒ Object
557
558
559
|
# File 'lib/dhall/ast.rb', line 557
def join(*)
""
end
|
#last ⇒ Object
549
550
551
|
# File 'lib/dhall/ast.rb', line 549
def last
OptionalNone.new(value_type: element_type)
end
|
#length ⇒ Object
537
538
539
|
# File 'lib/dhall/ast.rb', line 537
def length
0
end
|
#map(type: nil) ⇒ Object
525
526
527
|
# File 'lib/dhall/ast.rb', line 525
def map(type: nil)
type.nil? ? self : with(element_type: type)
end
|
#normalize ⇒ Object
263
264
265
|
# File 'lib/dhall/normalize.rb', line 263
def normalize
super.with(type: type.normalize)
end
|
#reduce(z) ⇒ Object
533
534
535
|
# File 'lib/dhall/ast.rb', line 533
def reduce(z)
z
end
|
#reverse ⇒ Object
553
554
555
|
# File 'lib/dhall/ast.rb', line 553
def reverse
self
end
|