Class: Dhall::Import::EnvironmentVariable
- Inherits:
-
Object
- Object
- Dhall::Import::EnvironmentVariable
- Defined in:
- lib/dhall/ast.rb
Instance Attribute Summary collapse
-
#var ⇒ Object
readonly
Returns the value of attribute var.
Instance Method Summary collapse
- #as_json ⇒ Object
- #canonical ⇒ Object
- #chain_onto(relative_to) ⇒ Object
- #hash ⇒ Object
-
#initialize(var) ⇒ EnvironmentVariable
constructor
A new instance of EnvironmentVariable.
- #origin ⇒ Object
- #path ⇒ Object
- #real_path ⇒ Object
- #resolve(resolver) ⇒ Object
- #to_s ⇒ Object
- #with(path:) ⇒ Object
Constructor Details
#initialize(var) ⇒ EnvironmentVariable
Returns a new instance of EnvironmentVariable.
1433 1434 1435 |
# File 'lib/dhall/ast.rb', line 1433 def initialize(var) @var = var end |
Instance Attribute Details
#var ⇒ Object (readonly)
Returns the value of attribute var.
1431 1432 1433 |
# File 'lib/dhall/ast.rb', line 1431 def var @var end |
Instance Method Details
#as_json ⇒ Object
1485 1486 1487 |
# File 'lib/dhall/ast.rb', line 1485 def as_json @var end |
#canonical ⇒ Object
1453 1454 1455 |
# File 'lib/dhall/ast.rb', line 1453 def canonical self end |
#chain_onto(relative_to) ⇒ Object
1437 1438 1439 1440 1441 1442 1443 |
# File 'lib/dhall/ast.rb', line 1437 def chain_onto(relative_to) if relative_to.is_a?(URI) raise ImportBannedException, "remote import cannot import #{self}" end self end |
#hash ⇒ Object
1476 1477 1478 |
# File 'lib/dhall/ast.rb', line 1476 def hash @var.hash end |
#origin ⇒ Object
1465 1466 1467 |
# File 'lib/dhall/ast.rb', line 1465 def origin "localhost" end |
#path ⇒ Object
1445 1446 1447 |
# File 'lib/dhall/ast.rb', line 1445 def path [] end |
#real_path ⇒ Object
1457 1458 1459 |
# File 'lib/dhall/ast.rb', line 1457 def real_path self end |
#resolve(resolver) ⇒ Object
1461 1462 1463 |
# File 'lib/dhall/ast.rb', line 1461 def resolve(resolver) resolver.resolve_environment(self) end |
#to_s ⇒ Object
1469 1470 1471 1472 1473 1474 |
# File 'lib/dhall/ast.rb', line 1469 def to_s escapes = Parser::PosixEnvironmentVariableCharacter::ESCAPES "env:#{@var.gsub(/[\"\\\a\b\f\n\r\t\v]/) do |c| "\\" + escapes.find { |(_, v)| v == c }.first end}" end |
#with(path:) ⇒ Object
1449 1450 1451 |
# File 'lib/dhall/ast.rb', line 1449 def with(path:) Path.from_string(path.join("/")) end |