Class: Dhall::Import::Path
- Inherits:
-
Object
- Object
- Dhall::Import::Path
show all
- Defined in:
- lib/dhall/ast.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(*path) ⇒ Path
1247
1248
1249
|
# File 'lib/dhall/ast.rb', line 1247
def initialize(*path)
super(path: path)
end
|
Class Method Details
.from_string(s) ⇒ Object
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
|
# File 'lib/dhall/ast.rb', line 1255
def self.from_string(s)
prefix, *suffix = s.to_s.split(/\//)
if prefix == ""
AbsolutePath.new(*suffix)
elsif prefix == "~"
RelativeToHomePath.new(*suffix)
elsif prefix == ".."
RelativeToParentPath.new(*suffix)
else
RelativePath.new(prefix, *suffix)
end
end
|
Instance Method Details
#as_json ⇒ Object
1284
1285
1286
|
# File 'lib/dhall/ast.rb', line 1284
def as_json
path
end
|
#canonical ⇒ Object
1268
1269
1270
|
# File 'lib/dhall/ast.rb', line 1268
def canonical
self.class.from_string(pathname.cleanpath)
end
|
#origin ⇒ Object
1276
1277
1278
|
# File 'lib/dhall/ast.rb', line 1276
def origin
"localhost"
end
|
#resolve(resolver) ⇒ Object
1272
1273
1274
|
# File 'lib/dhall/ast.rb', line 1272
def resolve(resolver)
resolver.resolve_path(self)
end
|
#to_s ⇒ Object
1280
1281
1282
|
# File 'lib/dhall/ast.rb', line 1280
def to_s
pathname.to_s
end
|
#with(path:) ⇒ Object
1251
1252
1253
|
# File 'lib/dhall/ast.rb', line 1251
def with(path:)
self.class.new(*path)
end
|