Host names, either fully qualified or just the short name, or even a regex
# 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
implementing eql? and hash so that when an HostName is stored in a hash it has the same hashing properties as the underlying value
# File lib/puppet/parser/ast/leaf.rb, line 99 def eql?(value) value = value.value if value.is_a?(HostName) @value.eql?(value) end
# File lib/puppet/parser/ast/leaf.rb, line 104 def hash @value.hash end