Class: Puppet::Parser::AST::Leaf
- Inherits:
-
Puppet::Parser::AST
- Object
- Puppet::Parser::AST
- Puppet::Parser::AST::Leaf
- Defined in:
- lib/puppet/parser/ast/leaf.rb
Overview
The base class for all of the leaves of the parse trees. These basically just have types and values. Both of these parameters are simple values, not AST objects.
Direct Known Subclasses
Constant Summary
Constants inherited from Puppet::Parser::AST
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from Puppet::Parser::AST
#file, #line, #parent, #pos, #scope
Instance Method Summary collapse
-
#evaluate(scope) ⇒ Object
Return our value.
-
#initialize(value: nil, file: nil, line: nil, pos: nil) ⇒ Leaf
constructor
A new instance of Leaf.
- #match(value) ⇒ Object
- #to_s ⇒ Object
Methods inherited from Puppet::Parser::AST
Methods included from Util::Errors
#adderrorcontext, #devfail, #error_context, error_location, error_location_with_space, error_location_with_unknowns, #exceptwrap, #fail
Constructor Details
#initialize(value: nil, file: nil, line: nil, pos: nil) ⇒ Leaf
Returns a new instance of Leaf.
23 24 25 26 |
# File 'lib/puppet/parser/ast/leaf.rb', line 23 def initialize(value: nil, file: nil, line: nil, pos: nil) @value = value super(file: file, line: line, pos: pos) end |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'lib/puppet/parser/ast/leaf.rb', line 8 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
8 9 10 |
# File 'lib/puppet/parser/ast/leaf.rb', line 8 def value @value end |
Instance Method Details
#evaluate(scope) ⇒ Object
Return our value.
11 12 13 |
# File 'lib/puppet/parser/ast/leaf.rb', line 11 def evaluate(scope) @value end |
#match(value) ⇒ Object
15 16 17 |
# File 'lib/puppet/parser/ast/leaf.rb', line 15 def match(value) @value == value end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/puppet/parser/ast/leaf.rb', line 19 def to_s @value.to_s unless @value.nil? end |