Class: AbideDevUtils::Ppt::Hiera::EntryPathLocalFile

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

Overview

Represents a local file derived from a Hiera path

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, facts, possible_fact_values) ⇒ EntryPathLocalFile

Returns a new instance of EntryPathLocalFile.



253
254
255
256
257
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 253

def initialize(path, facts, possible_fact_values)
  @path = File.expand_path(File.join(AbideDevUtils::Ppt::Hiera.default_datadir, path))
  @facts = facts
  @possible_fact_values = possible_fact_values
end

Instance Attribute Details

#factsObject (readonly)

Returns the value of attribute facts.



251
252
253
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 251

def facts
  @facts
end

#pathObject (readonly)

Returns the value of attribute path.



251
252
253
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 251

def path
  @path
end

Instance Method Details

#exist?Boolean

Returns:

  • (Boolean)


267
268
269
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 267

def exist?
  File.file?(path)
end

#fact_valuesObject



259
260
261
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 259

def fact_values
  @fact_values ||= fact_values_for_path
end

#path_partsObject



263
264
265
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 263

def path_parts
  @path_parts ||= path.split('/')
end

#to_hObject



275
276
277
278
279
280
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 275

def to_h
  {
    path: path,
    facts: facts
  }
end

#to_sObject



271
272
273
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 271

def to_s
  path
end