Class: AbideDevUtils::Ppt::Hiera::HierarchyEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/abide_dev_utils/ppt/hiera.rb

Overview

Represents a single entry in the hierarchy

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry) ⇒ HierarchyEntry

Returns a new instance of HierarchyEntry.



134
135
136
137
138
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 134

def initialize(entry)
  @entry = entry
  @name = @entry['name']
  @paths = @entry.key?('path') ? create_paths(@entry['path']) : create_paths(*@entry['paths'])
end

Instance Attribute Details

#entryObject (readonly)

Returns the value of attribute entry.



132
133
134
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 132

def entry
  @entry
end

#nameObject (readonly)

Returns the value of attribute name.



132
133
134
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 132

def name
  @name
end

#pathsObject (readonly)

Returns the value of attribute paths.



132
133
134
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 132

def paths
  @paths
end

Instance Method Details

#local_filesObject



140
141
142
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 140

def local_files
  @local_files ||= paths.map(&:local_files).flatten
end

#local_files_with_fact(fact_str, value = nil) ⇒ Object



144
145
146
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 144

def local_files_with_fact(fact_str, value = nil)
  paths.map { |p| p.local_files_with_fact(fact_str, value) }.flatten
end

#local_files_with_facts(*fact_arrays) ⇒ Object



148
149
150
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 148

def local_files_with_facts(*fact_arrays)
  paths.map { |p| p.local_files_with_facts(*fact_arrays) }.flatten
end

#to_sObject



152
153
154
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 152

def to_s
  name
end