Sha256: 72a7be46e1f10e7cc66dcafa4900520ba0ac42b17bce747ff6a972d31dc93051
Contents?: true
Size: 706 Bytes
Versions: 108
Compression:
Stored size: 706 Bytes
Contents
require "pathname" module Standard class ResolvesYamlOption def call(argv, search_path, option_name, default_file) search_argv(argv, option_name) || FileFinder.new.call(default_file, search_path) end private def search_argv(argv, option_name) return unless (config_file = argv_value_for(argv, option_name)) resolved_config = Pathname.new(config_file) if resolved_config.exist? resolved_config.expand_path else raise "Configuration file \"#{resolved_config.expand_path}\" not found." end end def argv_value_for(argv, option_name) return unless (index = argv.index(option_name)) argv[index + 1] end end end
Version data entries
108 entries across 108 versions & 3 rubygems