Class: RVGP::Utilities::Yaml::PsychInclude
- Inherits:
-
Object
- Object
- RVGP::Utilities::Yaml::PsychInclude
- Defined in:
- lib/rvgp/utilities/yaml.rb
Overview
This class is needed, in order to capture the dependencies needed to properly preserve uptodate status in rake builds
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#contents(include_paths) ⇒ Hash
The contents of this include target.
-
#initialize(path) ⇒ PsychInclude
constructor
Declare a proc, given the provided proc_as_string code.
Constructor Details
#initialize(path) ⇒ PsychInclude
Declare a proc, given the provided proc_as_string code
24 25 26 |
# File 'lib/rvgp/utilities/yaml.rb', line 24 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
20 21 22 |
# File 'lib/rvgp/utilities/yaml.rb', line 20 def path @path end |
Instance Method Details
#contents(include_paths) ⇒ Hash
The contents of this include target.
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rvgp/utilities/yaml.rb', line 35 def contents(include_paths) content_path = path if Pathname.new(path).absolute? content_path ||= include_paths.map { |p| [p.chomp('/'), path].join('/') }.find do |p| File.readable? p end unless content_path raise StandardError, format('Unable to find %<path>s in any of the provided paths: %<paths>s', path: path.inspect, paths: include_paths.inspect) end Psych.safe_load_file content_path, symbolize_names: true, permitted_classes: [Date, Symbol] end |