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 29 def initialize(value: nil, file: nil, line: nil, pos: nil) 30 super(value: value, file: file, line: line, pos: pos) 31 32 # Note that this is an AST::Regex, not a Regexp 33 unless @value.is_a?(Regex) 34 @value = @value.to_s.downcase 35 if @value =~ /[^-\w.]/ 36 raise Puppet::DevError, _("'%{value}' is not a valid hostname") % { value: @value } 37 end 38 end 39 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 43 def eql?(value) 44 @value.eql?(value.is_a?(HostName) ? value.value : value) 45 end
hash()
click to toggle source
# File lib/puppet/parser/ast/leaf.rb 47 def hash 48 @value.hash 49 end