Class: Recheck::Optimist::IOOption
- Defined in:
- lib/recheck/vendor/optimist.rb
Overview
Option class for handling IO objects and URLs. Note that this will return the file-handle, not the file-name in the case of file-paths given to it.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Option
#default, #long, #multi_given, #name, #permitted, #permitted_response, #short
Instance Method Summary collapse
Methods inherited from Option
#array_default?, #callback, create, #desc, #doesnt_need_autogen_short, #educate, #flag?, #format_stdio, #full_description, #initialize, #multi, #multi_arg?, #opts, #opts=, #permitted_type_valid?, #permitted_valid_string, #permitted_value?, register_alias, #required?, #single_arg?, #validate_permitted
Constructor Details
This class inherits a constructor from Recheck::Optimist::Option
Instance Method Details
#parse(paramlist, _neg_given) ⇒ Object
1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 |
# File 'lib/recheck/vendor/optimist.rb', line 1094 def parse(paramlist, _neg_given) paramlist.map do |pg| pg.map do |param| if /^(stdin|-)$/i.match?(param) $stdin else require "open-uri" begin open param rescue SystemCallError => e raise CommandlineError, "file or url for option '#{name}' cannot be opened: #{e.}" end end end end end |
#type_format ⇒ Object
1090 1091 1092 |
# File 'lib/recheck/vendor/optimist.rb', line 1090 def type_format "=<filename/uri>" end |