diff options
author | Whyme Lyu <[email protected]> | 2022-10-29 21:46:23 +0800 |
---|---|---|
committer | git <[email protected]> | 2022-10-29 13:46:27 +0000 |
commit | 37291df91dea2616559e64751ae6f8ed799c4310 () | |
tree | 8872736a734762cc9cad4eb29942629132df0fe1 /lib/optparse.rb | |
parent | 4dac53f0a48920f80ccaa4de151631659ab1d2ba (diff) |
[ruby/optparse] #load() into hash
(https://.com/ruby/optparse/pull/42) OptionParser#load learns .load(into: Hash) https://.com/ruby/optparse/commit/2ea626fcff Co-authored-by: Nobuyoshi Nakada <[email protected]>
-rw-r--r-- | lib/optparse.rb | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -1903,10 +1903,13 @@ XXX # directory ~/.options, then the basename with '.options' suffix # under XDG and Haiku standard places. # - def load(filename = nil) unless filename basename = File.basename($0, '.*') - return true if load(File.expand_path(basename, '~/.options')) rescue nil basename << ".options" return [ # XDG @@ -1918,11 +1921,11 @@ XXX '~/config/settings', ].any? {|dir| next if !dir or dir.empty? - load(File.expand_path(basename, dir)) rescue nil } end begin - parse(*IO.readlines(filename).each {|s| s.chomp!}) true rescue Errno::ENOENT, Errno::ENOTDIR false |