私はこれを頻繁にやっていることに気づきます:
optparse = OptionParser.new do |opts|
options[:directory] = "/tmp/"
opts.on('-d','--dir DIR', String, 'Directory to put the output in.') do |x|
raise "No such directory" unless File.directory?(x)
options[:directory] = x
end
end
orの代わりにDir
orを指定できればもっといいのですが。これを行うパターンまたはRuby風の方法はありますか?Pathname
String