class Dhall::Import

Constants

IMPORT_TYPES
Location
PATH_TYPES

Public Class Methods

decode(integrity_check, import_type, path_type, *parts) click to toggle source
# File lib/dhall/binary.rb, line 265
def self.decode(integrity_check, import_type, path_type, *parts)
        parts[0] = Dhall.decode(parts[0]) if path_type < 2 && !parts[0].nil?
        path_type = PATH_TYPES.fetch(path_type)

        new(
                IntegrityCheck.decode(integrity_check),
                IMPORT_TYPES[import_type],
                path_type.decode(*parts)
        )
end
new(integrity_check, import_type, path) click to toggle source
Calls superclass method
# File lib/dhall/ast.rb, line 1723
def initialize(integrity_check, import_type, path)
        super(
                integrity_check: integrity_check || NoIntegrityCheck.new,
                import_type:     import_type,
                path:            path
        )
end

Public Instance Methods

as_json() click to toggle source
# File lib/dhall/ast.rb, line 1758
def as_json
        [
                24,
                integrity_check&.as_json,
                IMPORT_TYPES.index(import_type),
                PATH_TYPES.index(path.class),
                *path.as_json
        ]
end
cache_key(relative_to) click to toggle source
# File lib/dhall/ast.rb, line 1749
def cache_key(relative_to)
        key = integrity_check.to_s
        if key.empty?
                real_path(relative_to)
        else
                key
        end
end
parse_resolve_check(raw, deadline: Util::NoDeadline.new, **kwargs) click to toggle source
# File lib/dhall/ast.rb, line 1743
def parse_resolve_check(raw, deadline: Util::NoDeadline.new, **kwargs)
        import_type.call(raw, deadline: deadline).resolve(**kwargs).then do |e|
                integrity_check.check(TypeChecker.annotate(e))
        end
end
real_path(relative_to) click to toggle source
# File lib/dhall/ast.rb, line 1739
def real_path(relative_to)
        path.chain_onto(relative_to).canonical
end
with(options) click to toggle source
# File lib/dhall/ast.rb, line 1731
def with(options)
        self.class.new(
                options.fetch(:integrity_check, integrity_check),
                options.fetch(:import_type, import_type),
                options.fetch(:path, path)
        )
end