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.
1591 1592 1593 |
# File 'lib/dhall/ast.rb', line 1591 def initialize(var) @var = var end |
Instance Attribute Details
#var ⇒ Object (readonly)
Returns the value of attribute var.
1589 1590 1591 |
# File 'lib/dhall/ast.rb', line 1589 def var @var end |
Class Method Details
.decode(*args) ⇒ Object
254 255 256 |
# File 'lib/dhall/binary.rb', line 254 def self.decode(*args) new(*args) end |
Instance Method Details
#as_json ⇒ Object
1647 1648 1649 |
# File 'lib/dhall/ast.rb', line 1647 def as_json @var end |
#canonical ⇒ Object
1611 1612 1613 |
# File 'lib/dhall/ast.rb', line 1611 def canonical self end |
#chain_onto(relative_to) ⇒ Object
1595 1596 1597 1598 1599 1600 1601 |
# File 'lib/dhall/ast.rb', line 1595 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: ==
1642 1643 1644 |
# File 'lib/dhall/ast.rb', line 1642 def eql?(other) other.is_a?(self.class) && other.var == var end |
#hash ⇒ Object
1638 1639 1640 |
# File 'lib/dhall/ast.rb', line 1638 def hash @var.hash end |
#location ⇒ Object
1634 1635 1636 |
# File 'lib/dhall/ast.rb', line 1634 def location Union.from(Location, "Environment", to_s.as_dhall) end |
#origin ⇒ Object
1623 1624 1625 |
# File 'lib/dhall/ast.rb', line 1623 def origin "localhost" end |
#path ⇒ Object
1603 1604 1605 |
# File 'lib/dhall/ast.rb', line 1603 def path [] end |
#real_path ⇒ Object
1615 1616 1617 |
# File 'lib/dhall/ast.rb', line 1615 def real_path self end |
#resolve(resolver) ⇒ Object
1619 1620 1621 |
# File 'lib/dhall/ast.rb', line 1619 def resolve(resolver) resolver.resolve_environment(self) end |
#to_s ⇒ Object
1627 1628 1629 1630 1631 1632 |
# File 'lib/dhall/ast.rb', line 1627 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
1607 1608 1609 |
# File 'lib/dhall/ast.rb', line 1607 def with(path:) Path.from_string(path.join("/")) end |