Class: MyExternalNode
- Inherits:
-
ExternalNode
- Object
- ExternalNode
- MyExternalNode
- Defined in:
- ext/regexp_nodes/regexp_nodes.rb
Overview
Logic for local hacks that don’t fit neatly into the autoloading model can happen as we initialize a subclass
Instance Attribute Summary
Attributes inherited from ExternalNode
#classes, #environment, #hostname, #parameters
Instance Method Summary collapse
-
#initialize(hostname, classdir = 'classes/', parameterdir = 'parameters/') ⇒ MyExternalNode
constructor
A new instance of MyExternalNode.
Methods inherited from ExternalNode
#match_classes, #match_environment, #match_parameters, #matched_in_patternfile?, #parse_argv, #to_yaml
Constructor Details
#initialize(hostname, classdir = 'classes/', parameterdir = 'parameters/') ⇒ MyExternalNode
Returns a new instance of MyExternalNode.
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'ext/regexp_nodes/regexp_nodes.rb', line 245 def initialize(hostname, classdir = 'classes/', parameterdir = 'parameters/') super # Set "hostclass" parameter based on hostname, # stripped of leading environment prefix and numeric suffix if @hostname =~ /^(\w*?)-?(\D+)(\d{2,3})$/ match = Regexp.last_match hostclass = match[2] log("matched hostclass #{hostclass}") @parameters[ "hostclass" ] = hostclass else log("couldn't figure out class from #{@hostname}",:warning) end end |