Class: AbideDevUtils::Ppt::Hiera::Hierarchy
- Inherits:
 - 
      Object
      
        
- Object
 - AbideDevUtils::Ppt::Hiera::Hierarchy
 
 
- Defined in:
 - lib/abide_dev_utils/ppt/hiera.rb
 
Overview
Represents the “hierarchy” section of the Hiera config
Instance Attribute Summary collapse
- 
  
    
      #default_datadir  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute default_datadir.
 - 
  
    
      #entries  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute entries.
 
Instance Method Summary collapse
- #entry_by_name(name) ⇒ Object
 - 
  
    
      #initialize(hierarchy, default_datadir)  ⇒ Hierarchy 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Hierarchy.
 - #method_missing(m, *args, &block) ⇒ Object
 - #respond_to_missing?(m, include_private = false) ⇒ Boolean
 
Constructor Details
#initialize(hierarchy, default_datadir) ⇒ Hierarchy
Returns a new instance of Hierarchy.
      99 100 101 102 103 104 105  | 
    
      # File 'lib/abide_dev_utils/ppt/hiera.rb', line 99 def initialize(hierarchy, default_datadir) @hierarchy = hierarchy @default_datadir = File.(default_datadir) @entries = @hierarchy.map { |h| HierarchyEntry.new(h) } @by_name_store = {} @paths_by_name_store = {} end  | 
  
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
      107 108 109 110 111 112 113  | 
    
      # File 'lib/abide_dev_utils/ppt/hiera.rb', line 107 def method_missing(m, *args, &block) if %i[each each_with_object each_with_index select reject map].include?(m) @entries.send(m, *args, &block) else super end end  | 
  
Instance Attribute Details
#default_datadir ⇒ Object (readonly)
Returns the value of attribute default_datadir.
      97 98 99  | 
    
      # File 'lib/abide_dev_utils/ppt/hiera.rb', line 97 def default_datadir @default_datadir end  | 
  
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
      97 98 99  | 
    
      # File 'lib/abide_dev_utils/ppt/hiera.rb', line 97 def entries @entries end  | 
  
Instance Method Details
#entry_by_name(name) ⇒ Object
      119 120 121 122 123 124 125 126 127  | 
    
      # File 'lib/abide_dev_utils/ppt/hiera.rb', line 119 def entry_by_name(name) AbideDevUtils::Validate.populated_string(name) return @by_name_store[name] if @by_name_store[name] found = @entries.select { |x| x.name == name } AbideDevUtils::Validate.not_empty(found, "Hierarchy entry for name '#{name}' not found") @by_name_store[name] = found[0] @by_name_store[name] end  | 
  
#respond_to_missing?(m, include_private = false) ⇒ Boolean
      115 116 117  | 
    
      # File 'lib/abide_dev_utils/ppt/hiera.rb', line 115 def respond_to_missing?(m, include_private = false) %i[each each_with_object each_with_index select reject map].include?(m) || super end  |