Class: Dhall::Import::Path
- Inherits:
-
Object
- Object
- Dhall::Import::Path
show all
- Defined in:
- lib/dhall/ast.rb,
lib/dhall/binary.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(*path) ⇒ Path
Returns a new instance of Path.
1482
1483
1484
|
# File 'lib/dhall/ast.rb', line 1482
def initialize(*path)
super(path: path)
end
|
Class Method Details
.decode(*args) ⇒ Object
248
249
250
|
# File 'lib/dhall/binary.rb', line 248
def self.decode(*args)
new(*args)
end
|
.from_string(s) ⇒ Object
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
|
# File 'lib/dhall/ast.rb', line 1490
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
1523
1524
1525
|
# File 'lib/dhall/ast.rb', line 1523
def as_json
path
end
|
#canonical ⇒ Object
1503
1504
1505
|
# File 'lib/dhall/ast.rb', line 1503
def canonical
self.class.from_string(pathname.cleanpath)
end
|
#location ⇒ Object
1519
1520
1521
|
# File 'lib/dhall/ast.rb', line 1519
def location
Union.from(Location, "Local", to_s.as_dhall)
end
|
#origin ⇒ Object
1511
1512
1513
|
# File 'lib/dhall/ast.rb', line 1511
def origin
"localhost"
end
|
#resolve(resolver) ⇒ Object
1507
1508
1509
|
# File 'lib/dhall/ast.rb', line 1507
def resolve(resolver)
resolver.resolve_path(self)
end
|
#to_s ⇒ Object
1515
1516
1517
|
# File 'lib/dhall/ast.rb', line 1515
def to_s
pathname.to_s
end
|
#with(path:) ⇒ Object
1486
1487
1488
|
# File 'lib/dhall/ast.rb', line 1486
def with(path:)
self.class.new(*path)
end
|