APIdock / Ruby
/
method

load

ruby latest stable - Class: OptionParser
load(filename = nil)
public

Loads options from file names as filename. Does nothing when the file is not present. Returns whether successfully loaded.

filename defaults to basename of the program without suffix in a directory ~/.options.

# File lib/optparse.rb, line 1781
 def load(filename = nil)
 begin
 filename ||= File.expand_path(File.basename(0,ドル '.*'), '~/.options')
 rescue
 return false
 end
 begin
 parse(*IO.readlines(filename).each {|s| s.chomp!})
 true
 rescue Errno::ENOENT, Errno::ENOTDIR
 false
 end
 end

AltStyle によって変換されたページ (->オリジナル) /