Sha256: 6a530894506289e0184d20ff2669c6eb40b2e328ce34c80cd9181317c312f91b
Contents?: true
Size: 928 Bytes
Versions: 2
Compression:
Stored size: 928 Bytes
Contents
# frozen_string_literal: true module JsDependency module CliUtils class Yaml attr_reader :args, :dir_path # @param [String, nil] dir_path def initialize(dir_path: nil) @dir_path = dir_path || Dir.pwd pathname = config_pathname @args = if pathname.nil? {} else symbolize_keys(YAML.safe_load(pathname.read)) end end private # @return [Pathname, nil] def config_pathname dir_pathname = Pathname.new(@dir_path) pathname = nil %w[.js_dependency.yml .js_dependency.yaml].each do |path| pathname = (dir_pathname + path) if (dir_pathname + path).exist? end pathname end # @param [Hash] hash # @return [Hash] def symbolize_keys(hash) hash.transform_keys(&:to_sym) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
js_dependency-0.3.9 | lib/js_dependency/cli_utils/yaml.rb |
js_dependency-0.3.8 | lib/js_dependency/cli_utils/yaml.rb |