class Puppet::Parser::AST::HostName

Host names, either fully qualified or just the short name, or even a regex

Public Class Methods

new(hash) click to toggle source
Calls superclass method
# 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

Public Instance Methods

eql?(value) click to toggle source

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
hash() click to toggle source
# File lib/puppet/parser/ast/leaf.rb, line 104
def hash
  @value.hash
end