Class: Dhall::Import::EnvironmentVariable
- Inherits:
-
Object
- Object
- Dhall::Import::EnvironmentVariable
- Defined in:
- lib/dhall/ast.rb,
lib/dhall/binary.rb
Instance Attribute Summary collapse
-
#var ⇒ Object
readonly
Returns the value of attribute var.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json ⇒ Object
- #canonical ⇒ Object
- #chain_onto(relative_to) ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(var) ⇒ EnvironmentVariable
constructor
A new instance of EnvironmentVariable.
- #location ⇒ Object
- #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.
1541 1542 1543 |
# File 'lib/dhall/ast.rb', line 1541 def initialize(var) @var = var end |
Instance Attribute Details
#var ⇒ Object (readonly)
Returns the value of attribute var.
1539 1540 1541 |
# File 'lib/dhall/ast.rb', line 1539 def var @var end |
Class Method Details
.decode(*args) ⇒ Object
248 249 250 |
# File 'lib/dhall/binary.rb', line 248 def self.decode(*args) new(*args) end |
Instance Method Details
#as_json ⇒ Object
1597 1598 1599 |
# File 'lib/dhall/ast.rb', line 1597 def as_json @var end |
#canonical ⇒ Object
1561 1562 1563 |
# File 'lib/dhall/ast.rb', line 1561 def canonical self end |
#chain_onto(relative_to) ⇒ Object
1545 1546 1547 1548 1549 1550 1551 |
# File 'lib/dhall/ast.rb', line 1545 def chain_onto(relative_to) if relative_to.is_a?(URI) raise ImportBannedException, "remote import cannot import #{self}" end self end |
#eql?(other) ⇒ Boolean Also known as: ==
1592 1593 1594 |
# File 'lib/dhall/ast.rb', line 1592 def eql?(other) other.is_a?(self.class) && other.var == var end |
#hash ⇒ Object
1588 1589 1590 |
# File 'lib/dhall/ast.rb', line 1588 def hash @var.hash end |
#location ⇒ Object
1584 1585 1586 |
# File 'lib/dhall/ast.rb', line 1584 def location Union.from(Location, "Environment", to_s.as_dhall) end |
#origin ⇒ Object
1573 1574 1575 |
# File 'lib/dhall/ast.rb', line 1573 def origin "localhost" end |
#path ⇒ Object
1553 1554 1555 |
# File 'lib/dhall/ast.rb', line 1553 def path [] end |
#real_path ⇒ Object
1565 1566 1567 |
# File 'lib/dhall/ast.rb', line 1565 def real_path self end |
#resolve(resolver) ⇒ Object
1569 1570 1571 |
# File 'lib/dhall/ast.rb', line 1569 def resolve(resolver) resolver.resolve_environment(self) end |
#to_s ⇒ Object
1577 1578 1579 1580 1581 1582 |
# File 'lib/dhall/ast.rb', line 1577 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
1557 1558 1559 |
# File 'lib/dhall/ast.rb', line 1557 def with(path:) Path.from_string(path.join("/")) end |