Class: 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
Instance Attribute Summary
Attributes inherited from Leaf
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
Constructor Details
#initialize(hash) ⇒ HostName
Returns a new instance of HostName.
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/puppet/parser/ast/leaf.rb', line 86 def initialize(hash) super # Note that this is an AST::Regex, not a Regexp unless @value.is_a?(Regex) @value = @value.to_s.downcase @value =~ /[^-\w.]/ and raise Puppet::DevError, "'#{@value}' is not a valid hostname" 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
99 100 101 102 |
# File 'lib/puppet/parser/ast/leaf.rb', line 99 def eql?(value) value = value.value if value.is_a?(HostName) @value.eql?(value) end |
#hash ⇒ Object
104 105 106 |
# File 'lib/puppet/parser/ast/leaf.rb', line 104 def hash @value.hash end |