別のキーワード
ライブラリ
クラス
- Array (100)
- CGI (12)
- CSV (48)
- Encoding (12)
-
Encoding
:: Converter (12) - Hash (12)
- Integer (24)
-
OpenSSL
:: BN (24) - OptionParser (144)
- String (12)
- StringScanner (12)
-
Thread
:: Queue (36) -
Thread
:: SizedQueue (36)
検索結果
先頭5件
-
Array
# unshift(*obj) -> self (3113.0) -
指定された obj を引数の最後から順番に配列の先頭に挿入します。 引数を指定しなければ何もしません。
...したいオブジェクトを指定します。
//emlist[例][ruby]{
arr = [1,2,3]
arr.unshift 0
p arr #=> [0, 1, 2, 3]
arr.unshift [0]
p arr #=> [[0], 0, 1, 2, 3]
arr.unshift 1, 2
p arr #=> [1, 2, [0], 0, 1, 2, 3]
//}
@see Array#push, Array#pop, Array#shift... -
OptionParser
# on(long , *rest) {|v| . . . } -> self (31.0) -
オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。
...の説明と見なします。
//emlist[][ruby]{
opts.on("--protocol VALUE", [:http, :ftp, :https]){|w|
p w
}
# ruby command --protocol=http #=> :http
opts.on("-c", "--charset VALUE", {"jis" => "iso-2022-jp", "sjis" => "shift_jis"}){|w|
p w
}
# ruby command --charset=jis #=> "iso-2022-jp"
//}... -
OptionParser
# on(long , pat = / . * / , desc = "") {|v| . . . } -> self (31.0) -
オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。
...dArgument が parse 実行時に投げられます。
opts.on("--username VALUE", /[a-zA-Z0-9_]+/){|name| ...}
# ruby command --username=ruby_user
# ruby command --username=ruby.user #=> Error
@param short ショートオプションを表す文字列を指定します。
@param long ロン... -
OptionParser
# on(short , *rest) {|v| . . . } -> self (31.0) -
オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。
...の説明と見なします。
//emlist[][ruby]{
opts.on("--protocol VALUE", [:http, :ftp, :https]){|w|
p w
}
# ruby command --protocol=http #=> :http
opts.on("-c", "--charset VALUE", {"jis" => "iso-2022-jp", "sjis" => "shift_jis"}){|w|
p w
}
# ruby command --charset=jis #=> "iso-2022-jp"
//}... -
OptionParser
# on(short , long , *rest) {|v| . . . } -> self (31.0) -
オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。
...の説明と見なします。
//emlist[][ruby]{
opts.on("--protocol VALUE", [:http, :ftp, :https]){|w|
p w
}
# ruby command --protocol=http #=> :http
opts.on("-c", "--charset VALUE", {"jis" => "iso-2022-jp", "sjis" => "shift_jis"}){|w|
p w
}
# ruby command --charset=jis #=> "iso-2022-jp"
//}... -
OptionParser
# on(short , long , pat = / . * / , desc = "") {|v| . . . } -> self (31.0) -
オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。
...dArgument が parse 実行時に投げられます。
opts.on("--username VALUE", /[a-zA-Z0-9_]+/){|name| ...}
# ruby command --username=ruby_user
# ruby command --username=ruby.user #=> Error
@param short ショートオプションを表す文字列を指定します。
@param long ロン... -
OptionParser
# on(short , pat = / . * / , desc = "") {|v| . . . } -> self (31.0) -
オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。
...dArgument が parse 実行時に投げられます。
opts.on("--username VALUE", /[a-zA-Z0-9_]+/){|name| ...}
# ruby command --username=ruby_user
# ruby command --username=ruby.user #=> Error
@param short ショートオプションを表す文字列を指定します。
@param long ロン... -
Encoding
# replicate(name) -> Encoding (25.0) -
レシーバのエンコーディングを複製(replicate)します。 複製されたエンコーディングは元のエンコーディングと同じバイト構造を持たなければなりません。 name という名前のエンコーディングが既に存在する場合は ArgumentError を発生します。
...いう名前のエンコーディングが既に存在する場合は ArgumentError を発生します。
Ruby 3.2 から非推奨となり、Ruby 3.3 で削除予定です。
//emlist[][ruby]{
encoding = Encoding::UTF_8.replicate("REPLICATED_UTF-8") #=> #<Encoding:REPLICATED_UTF-8>
encoding.n......ame #=> "REPLICATED_UTF-8"
"\u3042".force_encoding(Encoding::UTF_8).valid_encoding? #=> true
"\u3042".force_encoding(encoding).valid_encoding? #=> true
"\u3042".force_encoding(Encoding::SHIFT_JIS).valid_encoding? #=> false
//}... -
OptionParser
# on(long , klass = String , desc = "") {|v| . . . } -> self (21.0) -
オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。
...クに渡されます。
opts.on("-w", "--width N", Integer){|w|
p w.class #=> Integer
}
# ruby command --width=32
opts.on("-o", "--overwrite VALUE", TrueClass){|boolean| ...}
# ruby command --overwrite yes
@param short ショートオプションを表す文字列を指定します...