Class: Puppet::Parser::AST::HostName
- Inherits:
-
Leaf
- Object
- Puppet::Parser::AST
- Leaf
- Puppet::Parser::AST::HostName
- Defined in:
- lib/puppet/parser/ast/leaf.rb
Overview
Host names, either fully qualified or just the short name, or even a regex
Constant Summary
Constants inherited from Puppet::Parser::AST
Instance Attribute Summary
Attributes inherited from Leaf
Attributes inherited from Puppet::Parser::AST
#file, #line, #parent, #pos, #scope
Instance Method Summary collapse
-
#eql?(value) ⇒ Boolean
implementing eql? and hash so that when an HostName is stored in a hash it has the same hashing properties as the underlying value.
- #hash ⇒ Object
-
#initialize(hash) ⇒ HostName
constructor
A new instance of HostName.
Methods inherited from Leaf
Methods inherited from Puppet::Parser::AST
#evaluate, #inspect, #safeevaluate
Methods included from Util::MethodHelper
#requiredopts, #set_options, #symbolize_options
Methods included from Util::Errors
#adderrorcontext, #devfail, #error_context, #exceptwrap, #fail
Constructor Details
#initialize(hash) ⇒ HostName
Returns a new instance of HostName.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/puppet/parser/ast/leaf.rb', line 24 def initialize(hash) super # Note that this is an AST::Regex, not a Regexp unless @value.is_a?(Regex) @value = @value.to_s.downcase if @value =~ /[^-\w.]/ raise Puppet::DevError, "'#{@value}' is not a valid hostname" end end end |
Instance Method Details
#eql?(value) ⇒ Boolean
implementing eql? and hash so that when an HostName is stored in a hash it has the same hashing properties as the underlying value
38 39 40 |
# File 'lib/puppet/parser/ast/leaf.rb', line 38 def eql?(value) @value.eql?(value.is_a?(HostName) ? value.value : value) end |
#hash ⇒ Object
42 43 44 |
# File 'lib/puppet/parser/ast/leaf.rb', line 42 def hash @value.hash end |