class Puppet::Parser::AST::HostName
Host names, either fully qualified or just the short name, or even a regex
Public Class Methods
new(value: nil, file: nil, line: nil, pos: nil)
click to toggle source
Calls superclass method
Puppet::Parser::AST::Leaf::new
# File lib/puppet/parser/ast/leaf.rb 30 def initialize(value: nil, file: nil, line: nil, pos: nil) 31 super(value: value, file: file, line: line, pos: pos) 32 33 # Note that this is an AST::Regex, not a Regexp 34 unless @value.is_a?(Regex) 35 @value = @value.to_s.downcase 36 if @value =~ /[^-\w.]/ 37 raise Puppet::DevError, _("'%{value}' is not a valid hostname") % { value: @value } 38 end 39 end 40 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 44 def eql?(value) 45 @value.eql?(value.is_a?(HostName) ? value.value : value) 46 end
hash()
click to toggle source
# File lib/puppet/parser/ast/leaf.rb 48 def hash 49 @value.hash 50 end