Sha256: 28e6e2df60194d254befed846a3ba7d650afe4a158a5c958d73a9f1fceddd33b

Contents?: true

Size: 467 Bytes

Versions: 1

Compression:

Stored size: 467 Bytes

Contents

require 'optparse'

module Rhinestone
  class Config

    def initialize(argv)
      @options = extract_options(argv)
    end

    def to_h
      @options
    end

    private

    def extract_options(argv)
      options = {}

      cache_path_idx = argv.index('--cache-path') || argv.index('-C')

      if cache_path_idx
        options[:cache_path] = argv[cache_path_idx + 1]
        argv.slice!(cache_path_idx, 2)
      end

      return options
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rhinestone-0.0.2 lib/rhinestone/config.rb