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

Class Method Details

.decode(type) ⇒ Object



98
99
100
# File 'lib/dhall/binary.rb', line 98

def self.decode(type)
	EmptyList.new(type: Dhall.decode(type))
end

Instance Method Details

#[](_) ⇒ Object



500
501
502
# File 'lib/dhall/ast.rb', line 500

def [](_)
	OptionalNone.new(value_type: element_type)
end

#as_jsonObject



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

#eachObject



488
489
490
# File 'lib/dhall/ast.rb', line 488

def each
	self
end

#firstObject



504
505
506
# File 'lib/dhall/ast.rb', line 504

def first
	OptionalNone.new(value_type: element_type)
end

#joinObject



516
517
518
# File 'lib/dhall/ast.rb', line 516

def join(*)
	""
end

#lastObject



508
509
510
# File 'lib/dhall/ast.rb', line 508

def last
	OptionalNone.new(value_type: element_type)
end

#lengthObject



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

#normalizeObject



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

#reverseObject



512
513
514
# File 'lib/dhall/ast.rb', line 512

def reverse
	self
end