50件ヒット
[1-50件を表示]
(0.031秒)
種類
- 文書 (28)
- インスタンスメソッド (11)
- ライブラリ (11)
ライブラリ
- optparse (11)
クラス
- OptionParser (11)
キーワード
-
NEWS for Ruby 2
. 4 . 0 (8) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) - load (11)
-
ruby 1
. 8 . 4 feature (11)
検索結果
先頭5件
-
optparse (38282.0)
-
コマンドラインのオプションを取り扱うためのライブラリです。
...コマンドラインのオプションを取り扱うためのライブラリです。
=== チュートリアル
optparse を使う場合、基本的には
(1) OptionParser オブジェクト opt を生成する。
(2) オプションを取り扱うブロックを opt に登録する。
(3) o......る例です。
//emlist[sample.rb][ruby]{
require 'optparse'
opt = OptionParser.new
opt.on('-a') {|v| p v }
opt.on('-b') {|v| p v }
opt.parse!(ARGV)
p ARGV
//}
↓
ruby sample.rb -a foo bar -b baz
# => true
true
["foo", "bar", "baz"]
OptionParser#on メ......付けます。
//emlist[sample.rb][ruby]{
require 'optparse'
opt = OptionParser.new
opt.on('-a [VAL]') {|v| p v } # <- [VAL] を追加
opt.on('-b') {|v| p v }
opt.parse!(ARGV)
p ARGV
//}
↓
ruby sample.rb -a
# => nil
[]
同様に、ヘルプの見栄え... -
OptionParser
# load(filename = nil) -> bool (8161.0) -
指定された filename を読み込んで各行をまとめたものに対して OptionParser#parse を行ないます。
...ースが成功した場合に true を返します。
ファイルが存在しなかった場合に false を返します。
@param filename 各行をパースしたいファイルの名前を文字列で指定します。
指定されないか nil である場合、~/.options/ に......uby]{
require "optparse"
IO.write("options.txt", %w(-a --b).join("\n"))
options = { a: false, b: false }
OptionParser.new do |opt|
opt.on('-a') { |v| options[:a] = v }
opt.on('--b') {|v| options[:b] = v }
opt.load("options.txt") # => true
opt.load("not_exist.txt") # => false
end
p option......s # => {:a=>true, :b=>true}
//}... -
NEWS for Ruby 3
. 0 . 0 (126.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...used like a rightward assignment.
17260
* `in` is changed to return `true` or `false`. 17371
//emlist{
0 => a
p a #=> 0
{b: 0, c: 1} => {b:}
p b #=> 0
//}
//emlist{
# version 3.0
0 in 1 #=> false
# version 2.7
0 in 1 #=> raise NoMatchingPatternError
//}
* Find-pattern is adde......to lambda's arity check.
* When writing to STDOUT redirected to a closed pipe, no broken pipe error message will be shown now. 14413
* `TRUE`/`FALSE`/`NIL` constants are no longer defined.
* Integer#zero? overrides Numeric#zero? for optimization. 16961
* Enumerable#grep and Enumerable#grep......* drb
* debug
* erb
* find
* net-ftp
* net-http
* net-imap
* net-protocol
* open-uri
* optparse
* pp
* prettyprint
* resolv-replace
* resolv
* rinda
* set
* securerandom
* shellwords
* t... -
NEWS for Ruby 2
. 7 . 0 (114.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
..."children": [{ "name": "Bob", "age": 2 }]
}
END
JSON.parse(json, symbolize_names: true) in {name: "Alice", children: [{name: name, age: age}]}
p name #=> "Bob"
p age #=> 2
JSON.parse(json, symbolize_names: true) in {name: "Alice", children: [{name: "Charlie", age: age}]}
#=> NoMatchingPatternE......で**nilと書くことで、このメソッドがキーワードを
受け取らないことを明示できるようになりました。このようなメソッドを
キーワード引数付きで呼び出すとArgumentErrorになります。 14183
//emlist[][ruby]{
def foo(h, **nil); en......めたい場合は、コマンドライン引数に
「-W:no-deprecated」を指定するか、コードの中で
「Warning[:deprecated] = false」
としてください。
==== 番号指定パラメータ
* 番号指定パラメータ(Numbered parameters)がデフォルトのブロ... -
ruby 1
. 8 . 4 feature (90.0) -
ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。
...at]>))
* ((<ruby 1.8.4 feature/TCPSocket#initialize [bug]>))
* ((<ruby 1.8.4 feature/TCPServer#initialize [bug]>))
* ((<ruby 1.8.4 feature/"optparse">))
* ((<ruby 1.8.4 feature/"find">))
* ((<ruby 1.8.4 feature/Iconv>))
* ((<ruby 1.8.4 feature/WEBrick::Config::FileHandler [compat]>))
*......z]+x[0-9]+$/ =~ "hogex111")
p(/^[\x61-\x7a]+x[0-9]+$/ =~ "hogex111")
# => ruby 1.8.3 (2005-09-21) [i686-linux]
0
nil
# => ruby 1.8.4 (2005-12-22) [i686-linux]
0
0
: シグナル [bug]
#Sun Oct 16 03:38:07 2005 Yukihiro M......#
# * win32.h, win32.c (rb_w32_osid): check the running platform.
i-nodeを持たないシステム(Windows等)でtest(?-, ...)が常にtrueを返し
ていたバグを修正。((<ruby-core:06672>))
: File.identical? [new]
: FileTest.identical? [new]
test(?-, ...) の代替メ... -
NEWS for Ruby 2
. 4 . 0 (54.0) -
NEWS for Ruby 2.4.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...code 9.0 characters with some workarounds
for UTR #51 Unicode Emoji, Version 4.0 emoji zwj sequences.
* Regexp#match? を追加 8110
true/false を返し、バックリファレンスを生成しません。
* Onigmo 6.0.0 に更新 (Ruby 2.4.0)
* Onigmo 6.1.1 に更新 (Ruby....../OpenSSL 2.0
OpenSSL は https://github.com/ruby/openssl に分離されましたが、デフォルトGemとして残っています。
* optparse
* OptionParser#parseやOptionParser#orderにキーワード引数 into を追加 11191
* pathname
* Pathname#empty? を追加 12596......ASCIIのみ変換したい場合です。国際化ドメイン名の処理はよい例です。
* TRUE / FALSE / NIL
これらは廃止されました。12574
true / false / nil を使用してください。
=== 標準添付ライブラリの互換性(機能追加とバグ修正を...