Class: AbideDataProcessor::Parser::ProcessorObject
- Inherits:
-
Object
- Object
- AbideDataProcessor::Parser::ProcessorObject
- Includes:
- Validation
- Defined in:
- lib/abide-data-processor/parser.rb
Overview
This class holds all base attributes and methods for every syntax object. rubocop:disable Metrics/ClassLength
Instance Method Summary collapse
-
#after_me ⇒ Array
Returns any Resource objects that must be ordered after this object.
-
#before_me ⇒ Array
Returns any Resource objects that must be ordered before this object.
-
#initialize(name, data, control_maps) ⇒ ProcessorObject
constructor
A new instance of ProcessorObject.
-
#inspect ⇒ String
Gives a more detailed String representation of this object.
-
#name?(_name) ⇒ Boolean
Determines if the name supplied is equal to the name of the object.
-
#resource_data ⇒ Object
Abstract method to be implemented by subclasses.
-
#to_s ⇒ String
Converts this object to a String.
Methods included from Validation
#array_of_hashes?, #not_nil_or_empty?, #validate_control_maps, #validate_hiera_data
Constructor Details
#initialize(name, data, control_maps) ⇒ ProcessorObject
Returns a new instance of ProcessorObject.
283 284 285 286 287 288 289 |
# File 'lib/abide-data-processor/parser.rb', line 283 def initialize(name, data, control_maps) @name = name @data = validate_hiera_data(data) @control_maps = validate_control_maps(control_maps) @dependent = Set.new (@data, @control_maps) end |
Instance Method Details
#after_me ⇒ Array
Returns any Resource objects that must be ordered after this object.
314 315 316 |
# File 'lib/abide-data-processor/parser.rb', line 314 def after_me defined?(@after_me) ? @after_me : initialize_after_me end |
#before_me ⇒ Array
Returns any Resource objects that must be ordered before this object.
308 309 310 |
# File 'lib/abide-data-processor/parser.rb', line 308 def before_me defined?(@before_me) ? @before_me : initialize_before_me end |
#inspect ⇒ String
Gives a more detailed String representation of this object.
326 327 328 |
# File 'lib/abide-data-processor/parser.rb', line 326 def inspect "#<#{self.class.name}:#{object_id} '#{@name}'>" end |
#name?(_name) ⇒ Boolean
Determines if the name supplied is equal to the name of the object. This is overridden by subclasses to implement name mapped matches.
295 296 297 |
# File 'lib/abide-data-processor/parser.rb', line 295 def name?(_name) raise NotImplementedError, 'This method must be implemented by a subclass' end |
#resource_data ⇒ Object
Abstract method to be implemented by subclasses. Returns a representation of this object as a Hash usable by Puppet’s create_resources function.
302 303 304 |
# File 'lib/abide-data-processor/parser.rb', line 302 def resource_data raise NotImplementedError, 'This method must be implemented by a subclass' end |
#to_s ⇒ String
Converts this object to a String.
320 321 322 |
# File 'lib/abide-data-processor/parser.rb', line 320 def to_s "#{self.class.name}('#{@name}')" end |