Class: Dhall::ExpressionResolver::ImportResolver

Inherits:
Dhall::ExpressionResolver show all
Defined in:
lib/dhall/resolve.rb

Instance Method Summary collapse

Methods inherited from Dhall::ExpressionResolver

for, #initialize, register_for

Constructor Details

This class inherits a constructor from Dhall::ExpressionResolver

Instance Method Details

#resolve(resolver:, relative_to:) ⇒ Object



433
434
435
436
437
438
439
# File 'lib/dhall/resolve.rb', line 433

def resolve(resolver:, relative_to:)
  Promise.resolve(nil).then do
    resolver.cache_fetch(@expr.cache_key(relative_to)) do
      resolve_raw(resolver: resolver, relative_to: relative_to)
    end
  end
end

#resolve_raw(resolver:, relative_to:) ⇒ Object



441
442
443
444
445
446
447
448
449
# File 'lib/dhall/resolve.rb', line 441

def resolve_raw(resolver:, relative_to:)
  real_path = @expr.real_path(relative_to)
  real_path.resolve(resolver).then do |result|
    @expr.parse_and_check(result, deadline: resolver.deadline).resolve(
      resolver:    resolver.child(real_path),
      relative_to: real_path
    )
  end
end