Class: JsDependency::CliUtils::Yaml
- Inherits:
-
Object
- Object
- JsDependency::CliUtils::Yaml
- Defined in:
- lib/js_dependency/cli_utils/yaml.rb
Instance Attribute Summary collapse
-
#dir_path ⇒ Object
readonly
Returns the value of attribute dir_path.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #args ⇒ Hash
-
#initialize(dir_path: nil, path: nil) ⇒ Yaml
constructor
A new instance of Yaml.
Constructor Details
#initialize(dir_path: nil, path: nil) ⇒ Yaml
Returns a new instance of Yaml.
11 12 13 14 |
# File 'lib/js_dependency/cli_utils/yaml.rb', line 11 def initialize(dir_path: nil, path: nil) @dir_path = present?(dir_path) ? dir_path : Dir.pwd @path = path end |
Instance Attribute Details
#dir_path ⇒ Object (readonly)
Returns the value of attribute dir_path.
6 7 8 |
# File 'lib/js_dependency/cli_utils/yaml.rb', line 6 def dir_path @dir_path end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/js_dependency/cli_utils/yaml.rb', line 6 def path @path end |
Instance Method Details
#args ⇒ Hash
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/js_dependency/cli_utils/yaml.rb', line 17 def args pathname = if present?(@path) Pathname.new(@path) else config_pathname end if pathname.nil? {} else symbolize_keys(YAML.safe_load(pathname.read)) end end |