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.



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

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.



129
130
131
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 129

def entry
  @entry
end

#nameObject (readonly)

Returns the value of attribute name.



129
130
131
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 129

def name
  @name
end

#pathsObject (readonly)

Returns the value of attribute paths.



129
130
131
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 129

def paths
  @paths
end

Instance Method Details

#local_filesObject



137
138
139
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 137

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

#local_files_with_fact(fact_str, value = nil) ⇒ Object



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

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



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

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

#to_sObject



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

def to_s
  name
end