Class: Puppet::Parser::AST::HostName
- Inherits:
-
Leaf
- Object
- Puppet::Parser::AST
- Leaf
- Puppet::Parser::AST::HostName
- Defined in:
- lib/vendor/puppet/parser/ast/leaf.rb
Overview
Host names, either fully qualified or just the short name, or even a regex
Constant Summary
Constants inherited from Puppet::Parser::AST
Constants included from Util::Docs
Instance Attribute Summary
Attributes inherited from Leaf
Attributes inherited from Puppet::Parser::AST
Attributes included from Util::Docs
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.
- #to_s ⇒ Object
Methods inherited from Leaf
Methods inherited from Puppet::Parser::AST
associates_doc, #evaluate, #evaluate_match, #inspect, #parsefail, #parsewrap, #safeevaluate, settor?, #use_docs
Methods included from Util::Docs
#desc, #dochook, #doctable, #markdown_definitionlist, #markdown_header, #nodoc?, #pad, scrub
Methods included from Util::MethodHelper
#requiredopts, #set_options, #symbolize_options
Methods included from Util::Errors
#adderrorcontext, #devfail, #error_context, #exceptwrap, #fail
Constructor Details
#initialize(hash) ⇒ HostName
Returns a new instance of HostName.
93 94 95 96 97 98 99 100 101 102 |
# File 'lib/vendor/puppet/parser/ast/leaf.rb', line 93 def initialize(hash) super # Note that this is an AST::Regex, not a Regexp @value = @value.to_s.downcase unless @value.is_a?(Regex) if @value =~ /[^-\w.]/ 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
106 107 108 109 |
# File 'lib/vendor/puppet/parser/ast/leaf.rb', line 106 def eql?(value) value = value.value if value.is_a?(HostName) @value.eql?(value) end |
#hash ⇒ Object
111 112 113 |
# File 'lib/vendor/puppet/parser/ast/leaf.rb', line 111 def hash @value.hash end |
#to_s ⇒ Object
115 116 117 |
# File 'lib/vendor/puppet/parser/ast/leaf.rb', line 115 def to_s @value.to_s end |