別のキーワード
クラス
モジュール
- Abbrev (12)
- Kernel (12)
-
Net
:: HTTPHeader (24) -
OptionParser
:: Arguable (24)
キーワード
-
$ OUTPUT _ RECORD _ SEPARATOR (12) -
NEWS for Ruby 3
. 0 . 0 (5) - Numeric (12)
- abbrev (12)
-
basic
_ auth (12) - chr (36)
-
keyword
_ init? (4) - new (16)
-
optparse
/ shellwords (12) - order (48)
- order! (48)
-
primitive
_ convert (48) -
proxy
_ basic _ auth (12) -
ruby 1
. 9 feature (12) -
ruby2
_ keywords (18) -
ruby2
_ keywords _ hash? (6) -
to
_ h (14) - ungetc (12)
検索結果
先頭5件
-
Integer
# ord -> Integer (18131.0) -
自身を返します。
...自身を返します。
//emlist[][ruby]{
10.ord #=> 10
# String#ord
?a.ord #=> 97
//}
@see String#ord... -
String
# ord -> Integer (18113.0) -
文字列の最初の文字の文字コードを整数で返します。
...の文字コードを整数で返します。
self が空文字列のときは例外を発生します。
@return 文字コードを表す整数
@raise ArgumentError self の長さが 0 のとき発生
//emlist[例][ruby]{
p "a".ord # => 97
//}
@see Integer#chr, String#chr... -
Hash
. ruby2 _ keywords _ hash?(hash) -> bool (12291.0) -
Module#ruby2_keywordsやProc#ruby2_keywordsによる ruby2_keywords フラグが設定されているかどうかを返します。
...Module#ruby2_keywordsやProc#ruby2_keywordsによる
ruby2_keywords フラグが設定されているかどうかを返します。
このメソッドはデバッグや調査、シリアライゼーションのために本当に必要な場合のために
用意されていて、普通のプログ......れていません。
ruby 2.7.1 で追加されたため、ruby 2.7.0 では定義されていません。
//emlist[][ruby]{
ruby2_keywords def foo(*args)
Hash.ruby2_keywords_hash?(args.last)
end
foo(k: 1) # => true
foo({k: 1}) # => false
//}
@see Module#ruby2_keywords, Proc#ruby2_keywords... -
Module
# ruby2 _ keywords(method _ name , . . . ) -> nil (12231.0) -
For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.
...s, marks the method as passing keywords through
a normal argument splat. This should only be called on methods that
accept an argument splat (`*args`) but not explicit keywords or a
keyword splat. It marks the method such that if the method is called
with keyword arguments, the final hash argument......explicit
keywords or a keyword splat, the final element is interpreted as
keywords. In other words, keywords will be passed through the method to
other methods.
This should only be used for methods that delegate keywords to another
method, and only for backwards compatibility with Ruby versions bef......ility. As it does not exist in Ruby versions
before 2.7, check that the module responds to this method before calling
it. Also, be aware that if this method is removed, the behavior of the
method will change so that it does not pass through keywords.
//emlist[例][ruby]{
module Mod
def foo(meth,... -
Proc
# ruby2 _ keywords -> proc (12231.0) -
Marks the proc as passing keywords through a normal argument splat. This should only be called on procs that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the proc such that if the proc is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the proc to other methods.
...Marks the proc as passing keywords through a normal argument splat. This
should only be called on procs that accept an argument splat (`*args`)
but not explicit keywords or a keyword splat. It marks the proc such
that if the proc is called with keyword arguments, the final hash
argument is marked......e explicit keywords or a keyword splat, the
final element is interpreted as keywords. In other words, keywords will
be passed through the proc to other methods.
This should only be used for procs that delegate keywords to another
method, and only for backwards compatibility with Ruby versions befo......atibility. As it does not exist in Ruby versions
before 2.7, check that the proc responds to this method before calling
it. Also, be aware that if this method is removed, the behavior of the
proc will change so that it does not pass through keywords.
//emlist[][ruby]{
module Mod
foo = ->(meth, *a... -
OptionParser
# order!(argv = self . default _ argv) -> [String] (6112.0) -
与えられた argv を順番に破壊的にパースします。 argv からオプションがすべて取り除かれます。 argv を返します。
...ParseError のサブク
ラスになります。
//emlist[opt.rb][ruby]{
require 'optparse'
opt = OptionParser.new
opt.on('-a [VAL]') {|v| p :a }
opt.on('-b') {|v| p :b }
opt.order!(ARGV)
p ARGV
//}
↓
$ ruby opt.rb -a foo somefile -b
:a
["somefile", "-b"]... -
OptionParser
# order!(argv = self . default _ argv) {|s| . . . } -> [String] (6112.0) -
与えられた argv を順番に破壊的にパースします。 argv からオプションがすべて取り除かれます。 argv を返します。
...ParseError のサブク
ラスになります。
//emlist[opt.rb][ruby]{
require 'optparse'
opt = OptionParser.new
opt.on('-a [VAL]') {|v| p :a }
opt.on('-b') {|v| p :b }
opt.order!(ARGV)
p ARGV
//}
↓
$ ruby opt.rb -a foo somefile -b
:a
["somefile", "-b"]... -
OptionParser
# order!(argv = self . default _ argv , into: nil) -> [String] (6112.0) -
与えられた argv を順番に破壊的にパースします。 argv からオプションがすべて取り除かれます。 argv を返します。
...ParseError のサブク
ラスになります。
//emlist[opt.rb][ruby]{
require 'optparse'
opt = OptionParser.new
opt.on('-a [VAL]') {|v| p :a }
opt.on('-b') {|v| p :b }
opt.order!(ARGV)
p ARGV
//}
↓
$ ruby opt.rb -a foo somefile -b
:a
["somefile", "-b"]... -
OptionParser
# order!(argv = self . default _ argv , into: nil) {|s| . . . } -> [String] (6112.0) -
与えられた argv を順番に破壊的にパースします。 argv からオプションがすべて取り除かれます。 argv を返します。
...ParseError のサブク
ラスになります。
//emlist[opt.rb][ruby]{
require 'optparse'
opt = OptionParser.new
opt.on('-a [VAL]') {|v| p :a }
opt.on('-b') {|v| p :b }
opt.order!(ARGV)
p ARGV
//}
↓
$ ruby opt.rb -a foo somefile -b
:a
["somefile", "-b"]... -
OptionParser
# order(*args) -> [String] (6112.0) -
与えられた argv を順番にパースします。 オプションではないコマンドの引数(下の例で言うと somefile)に出会うと、パースを中断します。 argv からオプションを取り除いたものを返します。
...サブク
ラスになります。
//emlist[opt.rb][ruby]{
require 'optparse'
opt = OptionParser.new
opt.on('-a [VAL]') {|v| p :a }
opt.on('-b') {|v| p :b }
opt.order(ARGV)
p ARGV
//}
↓
$ ruby opt.rb -a foo somefile -b
:a
["-a", "foo", "somefile", "-b"]... -
OptionParser
# order(*args) {|s| . . . } -> [String] (6112.0) -
与えられた argv を順番にパースします。 オプションではないコマンドの引数(下の例で言うと somefile)に出会うと、パースを中断します。 argv からオプションを取り除いたものを返します。
...サブク
ラスになります。
//emlist[opt.rb][ruby]{
require 'optparse'
opt = OptionParser.new
opt.on('-a [VAL]') {|v| p :a }
opt.on('-b') {|v| p :b }
opt.order(ARGV)
p ARGV
//}
↓
$ ruby opt.rb -a foo somefile -b
:a
["-a", "foo", "somefile", "-b"]... -
OptionParser
# order(*args , into: nil) -> [String] (6112.0) -
与えられた argv を順番にパースします。 オプションではないコマンドの引数(下の例で言うと somefile)に出会うと、パースを中断します。 argv からオプションを取り除いたものを返します。
...サブク
ラスになります。
//emlist[opt.rb][ruby]{
require 'optparse'
opt = OptionParser.new
opt.on('-a [VAL]') {|v| p :a }
opt.on('-b') {|v| p :b }
opt.order(ARGV)
p ARGV
//}
↓
$ ruby opt.rb -a foo somefile -b
:a
["-a", "foo", "somefile", "-b"]... -
OptionParser
# order(*args , into: nil) {|s| . . . } -> [String] (6112.0) -
与えられた argv を順番にパースします。 オプションではないコマンドの引数(下の例で言うと somefile)に出会うと、パースを中断します。 argv からオプションを取り除いたものを返します。
...サブク
ラスになります。
//emlist[opt.rb][ruby]{
require 'optparse'
opt = OptionParser.new
opt.on('-a [VAL]') {|v| p :a }
opt.on('-b') {|v| p :b }
opt.order(ARGV)
p ARGV
//}
↓
$ ruby opt.rb -a foo somefile -b
:a
["-a", "foo", "somefile", "-b"]... -
OptionParser
# order(argv) -> [String] (6112.0) -
与えられた argv を順番にパースします。 オプションではないコマンドの引数(下の例で言うと somefile)に出会うと、パースを中断します。 argv からオプションを取り除いたものを返します。
...サブク
ラスになります。
//emlist[opt.rb][ruby]{
require 'optparse'
opt = OptionParser.new
opt.on('-a [VAL]') {|v| p :a }
opt.on('-b') {|v| p :b }
opt.order(ARGV)
p ARGV
//}
↓
$ ruby opt.rb -a foo somefile -b
:a
["-a", "foo", "somefile", "-b"]... -
OptionParser
# order(argv) {|s| . . . } -> [String] (6112.0) -
与えられた argv を順番にパースします。 オプションではないコマンドの引数(下の例で言うと somefile)に出会うと、パースを中断します。 argv からオプションを取り除いたものを返します。
...サブク
ラスになります。
//emlist[opt.rb][ruby]{
require 'optparse'
opt = OptionParser.new
opt.on('-a [VAL]') {|v| p :a }
opt.on('-b') {|v| p :b }
opt.order(ARGV)
p ARGV
//}
↓
$ ruby opt.rb -a foo somefile -b
:a
["-a", "foo", "somefile", "-b"]...