Sha256: 4283856428d26d1328cde859dc14f4443e77c3e166859b0916cb3302202244e8

Contents?: true

Size: 1.24 KB

Versions: 8

Compression:

Stored size: 1.24 KB

Contents

#
# Copyright:: Copyright 2016, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require "license_scout/overrides"

module LicenseScout
  class Options
    SUPPORTED_OPTIONS = [:overrides, :environment, :ruby_bin, :cpan_cache, :manual_licenses].freeze

    SUPPORTED_OPTIONS.each do |o|
      send(:attr_reader, o)
    end

    def initialize(options = {})
      SUPPORTED_OPTIONS.each do |o|
        data = options[o] || defaults[o]
        instance_variable_set("@#{o}".to_sym, data)
      end
    end

    private

    def defaults
      {
        overrides: Overrides.new,
        environment: {},
        ruby_bin: nil,
        cpan_cache: Dir.tmpdir,
        manual_licenses: nil,
      }
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
license_scout-1.0.29 lib/license_scout/options.rb
license_scout-1.0.28 lib/license_scout/options.rb
license_scout-1.0.27 lib/license_scout/options.rb
license_scout-1.0.26 lib/license_scout/options.rb
license_scout-1.0.25 lib/license_scout/options.rb
license_scout-1.0.24 lib/license_scout/options.rb
license_scout-1.0.22 lib/license_scout/options.rb
license_scout-1.0.21 lib/license_scout/options.rb