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



510
511
512
513
514
515
516
517
# File 'lib/dhall/parser.rb', line 510

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

#valueObject



500
501
502
503
504
505
506
507
508
# File 'lib/dhall/parser.rb', line 500

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