Module: Dhall::Parser::Http

Defined in:
lib/dhall/parser.rb

Constant Summary collapse

SCHEME =
{
	"http"  => Dhall::Import::Http,
	"https" => Dhall::Import::Https
}.freeze

Instance Method Summary collapse

Instance Method Details

#http(key) ⇒ Object



557
558
559
560
# File 'lib/dhall/parser.rb', line 557

def http(key)
	@http ||= capture(:http_raw)
	@http.capture(key)&.value
end

#valueObject



562
563
564
565
566
567
568
569
570
571
572
573
574
575
# File 'lib/dhall/parser.rb', line 562

def value
	uri = http(:scheme).build(
		http(:authority).merge(
			path: http(:url_path) || "/"
		)
	)

	uri.instance_variable_set(:@query, http(:query))

	SCHEME.fetch(uri.scheme).new(
		headers: capture(:import_expression)&.value,
		uri:     uri
	)
end