Class: AbideDevUtils::Ppt::Hiera::EntryPathLocalFile
- Inherits:
-
Object
- Object
- AbideDevUtils::Ppt::Hiera::EntryPathLocalFile
- Defined in:
- lib/abide_dev_utils/ppt/hiera.rb
Overview
Represents a local file derived from a Hiera path
Instance Attribute Summary collapse
-
#fact_values ⇒ Object
readonly
Returns the value of attribute fact_values.
-
#facts ⇒ Object
readonly
Returns the value of attribute facts.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
- #exist? ⇒ Boolean
-
#initialize(path, facts, values) ⇒ EntryPathLocalFile
constructor
A new instance of EntryPathLocalFile.
- #path_parts ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(path, facts, values) ⇒ EntryPathLocalFile
Returns a new instance of EntryPathLocalFile.
256 257 258 259 260 261 |
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 256 def initialize(path, facts, values) @path = File.(File.join(AbideDevUtils::Ppt::Hiera.default_datadir, path)) @facts = facts @values = values @fact_values = @facts.zip(@values).to_h end |
Instance Attribute Details
#fact_values ⇒ Object (readonly)
Returns the value of attribute fact_values.
254 255 256 |
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 254 def fact_values @fact_values end |
#facts ⇒ Object (readonly)
Returns the value of attribute facts.
254 255 256 |
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 254 def facts @facts end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
254 255 256 |
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 254 def path @path end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
254 255 256 |
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 254 def values @values end |
Instance Method Details
#exist? ⇒ Boolean
267 268 269 |
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 267 def exist? File.file?(path) end |
#path_parts ⇒ Object
263 264 265 |
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 263 def path_parts @path_parts ||= path.split('/') end |
#to_h ⇒ Object
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_s ⇒ Object
271 272 273 |
# File 'lib/abide_dev_utils/ppt/hiera.rb', line 271 def to_s path end |