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



584
585
586
587
# File 'lib/dhall/parser.rb', line 584

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

#valueObject



589
590
591
592
593
594
595
596
597
598
599
600
601
602
# File 'lib/dhall/parser.rb', line 589

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