Class: Standard::ParsesCliOption
- Inherits:
-
Object
- Object
- Standard::ParsesCliOption
- Defined in:
- lib/standard/parses_cli_option.rb
Instance Method Summary collapse
Instance Method Details
#argv_value_for(argv, option_name) ⇒ Object
16 17 18 19 |
# File 'lib/standard/parses_cli_option.rb', line 16 def argv_value_for(argv, option_name) return unless (index = argv.index(option_name)) argv[index + 1] end |
#call(argv, option_name) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/standard/parses_cli_option.rb', line 5 def call(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. else raise "Configuration file \"#{resolved_config.expand_path}\" not found." end end |