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

#unescaped_componentsObject



548
549
550
551
552
553
554
555
# File 'lib/dhall/parser.rb', line 548

def unescaped_components
  capture(:http_raw)
    .capture(:path)
    .captures(:path_component)
    .map do |pc|
      pc.value(URI.method(:unescape))
    end
end

#valueObject



538
539
540
541
542
543
544
545
546
# File 'lib/dhall/parser.rb', line 538

def value
  http = capture(:http_raw)
  SCHEME.fetch(http.capture(:scheme).value).new(
    capture(:import_hashed)&.value(Dhall::Import::Expression),
    http.capture(:authority).value,
    *unescaped_components,
    http.capture(:query)&.value
  )
end