Sha256: e83034f3a625e6a84f33d681723cbdaf1b5ea1406891e0eae9a55f0d80c124bc

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

module JsDependency
  module CliUtils
    class Config
      attr_reader :src_path, :target_paths, :target_path, :child_analyze_level, :parent_analyze_level, :output_path,
                  :alias_paths, :name_level, :excludes

      # @param [Hash] options
      # @param [Hash] args
      def initialize(options, args)
        @src_path = options[:src_path] || args[:src_path]
        @target_paths = options[:target_paths] || (args[:target_path].is_a?(String) ? [args[:target_path]] : args[:target_path])
        @target_path = options[:target_path] || args[:target_path]
        @child_analyze_level = options[:child_analyze_level] || args[:child_analyze_level] || 2
        @parent_analyze_level = options[:parent_analyze_level] || args[:parent_analyze_level] || 2
        @output_path = options[:output_path] || args[:output_path] || nil
        @alias_paths = options[:alias_paths] || args[:alias_paths] || {}
        @name_level = options[:name_level] || args[:name_level] || 1
        @excludes = if options[:excludes]&.length&.positive?
                      options[:excludes]
                    elsif args[:excludes]
                      args[:excludes]
                    end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
js_dependency-0.3.10 lib/js_dependency/cli_utils/config.rb
js_dependency-0.3.9 lib/js_dependency/cli_utils/config.rb