Sha256: 6587ba6561dcfa51fd0c2298ecd419215b90dae137c43c2d5eae3112bd9930e1

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 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]

    SUPPORTED_OPTIONS.each do |o|
      self.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,
      }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
license_scout-0.1.2 lib/license_scout/options.rb
license_scout-0.1.1 lib/license_scout/options.rb