種類
- モジュール関数 (80)
- インスタンスメソッド (48)
キーワード
- Array (12)
- Rational (12)
-
convertible
_ int (24) -
global
_ variables (12) -
local
_ variables (12) - loop (20)
- p (12)
-
psych
_ y (12)
検索結果
先頭5件
-
Kernel
# y(*objects) -> nil (18227.0) -
objects を YAML document として標準出力に出力します。
...objects を YAML document として標準出力に出力します。
このメソッドは irb 上でのみ定義されます。
syck に y メソッドがあるため、
psych_y が別名として定義されています。将来的に
syck が廃止された場合 psych_y は廃止
される予......定であるため、特別の事情がない限り y を用いてください。
@param objects YAML document に変換する Ruby のオブジェクト... -
Kernel
# psych _ y(*objects) -> nil (6227.0) -
objects を YAML document として標準出力に出力します。
...objects を YAML document として標準出力に出力します。
このメソッドは irb 上でのみ定義されます。
syck に y メソッドがあるため、
psych_y が別名として定義されています。将来的に
syck が廃止された場合 psych_y は廃止
される予......定であるため、特別の事情がない限り y を用いてください。
@param objects YAML document に変換する Ruby のオブジェクト... -
Kernel
. # Array(arg) -> Array (6113.0) -
引数を配列(Array)に変換した結果を返します。
...引数を配列(Array)に変換した結果を返します。
arg.to_ary と arg.to_a をこの順に呼び出して、返ってきた配列を変換結果とします。
arg に to_ary, to_a のいずれのメソッドも定義されていない場合は
一要素の配列 [arg] を返します......。
@param arg 変換対象のオブジェクトです。
@raise TypeError to_ary, to_a の返り値が配列でなければ発生します
//emlist[例][ruby]{
p Array({:it => 3}) #=> [[:it, 3]]
p Array(nil) #=> []
p Array("fefe") #=> ["fefe"]
//}
@see Object#to_a,Object#to_ary,Array... -
Kernel
. # p(*arg) -> object | Array (214.0) -
引数を人間に読みやすい形に整形して改行と順番に標準出力 $stdout に出力します。主にデバッグに使用します。
...と改行を順番に出力します。つまり以下のコードと同じです。
//emlist[例][ruby]{
print arg[0].inspect, "\n", arg[1].inspect, "\n" #, ...
//}
整形に用いられるObject#inspectは普通に文字列に変換すると
区別がつかなくなるようなクラス間の差......された引数 arg を返します。複数の引数が指定された場合はそれらを要素とする配列を返します。
//emlist[例][ruby]{
puts "" #=> (空行)
p "" #=> ""
puts 50,"50"
#=> 50
#=> 50
p 50,"50"
#=> 50
#=> "50"
//}
@see Object#inspect,Kernel.#puts,Kernel.#print... -
Kernel
. # Rational(x , y = 1) -> Rational (126.0) -
引数を有理数(Rational)に変換した結果を返します。
...m y 変換対象のオブジェクトです。省略した場合は x だけを用いて
Rational オブジェクトを作成します。
@raise ArgumentError 変換できないオブジェクトを指定した場合に発生します。
引数 x、y の両方を指定した場合、x/y......数にする事も可能ですが、分母には指定できませ
ん。また、Kernel.#Integer とは違い "0x10" のような進数を表す接頭
辞を含めた指定は行えません。
//emlist[例][ruby]{
Rational("1/3") # => (1/3)
Rational("0.3") # => (3/10)
Rational('0.3E......ntError
//}
引数に変換できないオブジェクトを指定した場合には ArgumentError が
発生します。
//emlist[例][ruby]{
Rational(Object.new) # => ArgumentError
Rational("") # => ArgumentError
Rational(nil) # => ArgumentError
//}
また、Rational('0.3')... -
Kernel
. # Rational(x , y = 1 , exception: true) -> Rational | nil (126.0) -
引数を有理数(Rational)に変換した結果を返します。
...引数を有理数(Rational)に変換した結果を返します。
@param x 変換対象のオブジェクトです。
@param y 変換対象のオブジェクトです。省略した場合は x だけを用いて
Rational オブジェクトを作成します。
@param exception false......数にする事も可能ですが、分母には指定できませ
ん。また、Kernel.#Integer とは違い "0x10" のような進数を表す接頭
辞を含めた指定は行えません。
//emlist[例][ruby]{
Rational("1/3") # => (1/3)
Rational("0.3") # => (3/10)
Rational('0.3E......ntError
//}
引数に変換できないオブジェクトを指定した場合には ArgumentError が
発生します。
//emlist[例][ruby]{
Rational(Object.new) # => ArgumentError
Rational("") # => ArgumentError
Rational(nil) # => ArgumentError
//}
また、Rational('0.3')... -
Kernel
. # loop { . . . } -> object | nil (120.0) -
(中断されない限り)永遠にブロックの評価を繰り返します。 ブロックが指定されなければ、代わりに Enumerator を返します。
...ければ、代わりに Enumerator を返します。
//emlist[例][ruby]{
loop do
print "Input: "
line = gets
break if !line or line =~ /^qQ/
# ...
end
//}
与えられたブロック内で StopIteration を Kernel.#raise すると
ループを終了して Enumerator が最後に返し......た値を返します。
ループを終了させる場合、通常は break を使用してください。
//emlist[例][ruby]{
enum = Enumerator.new { |y|
y << "one"
y << "two"
:ok
}
result = loop {
puts enum.next
} # => :ok
//}
@return break の引数など、ループ脱出時の値... -
Kernel
# convertible _ int(type , headers = nil , opts = nil) (117.0) -
Returns the convertible integer type of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. _Convertible_ means actually same type, or typedefed from same type. If the +type+ is a integer type and _convertible_ type is found, following macros are passed as preprocessor constants to the compiler using the +type+ name, in uppercase. * 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X' is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP, where 'TYP' is the +type+ name in uppercase with replacing '_t' suffix with 'T', followed by '=X' where 'X' is the macro name to convert +type+ to +Integer+ object, and vice versa. For example, if foobar_t is defined as unsigned long, then convertible_int("foobar_t") would return "unsigned long", and define macros: #define TYPEOF_FOOBAR_T unsigned long #define FOOBART2NUM ULONG2NUM #define NUM2FOOBART NUM2ULONG
...Returns the convertible integer type of the given +type+. You may
optionally specify additional +headers+ to search in for the +type+.
_Convertible_ means actually same type, or typedefed from same type.
If the +type+ is a integer type and _convertible_ type is found,
following macros are p......mpiler using the +type+ name, in uppercase.
* 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X'
is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP,
where 'TYP' is the +type+ name in uppercase with replacing '_t'
suffix with 'T', followed by '=X' where 'X' is......the macro name to
convert +type+ to +Integer+ object, and vice versa.
For example, if foobar_t is defined as unsigned long, then
convertible_int("foobar_t") would return "unsigned long", and define
macros:
#define TYPEOF_FOOBAR_T unsigned long
#define FOOBART2NUM ULONG2NUM
#defin... -
Kernel
# convertible _ int(type , headers = nil , opts = nil) { . . . } (117.0) -
Returns the convertible integer type of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. _Convertible_ means actually same type, or typedefed from same type. If the +type+ is a integer type and _convertible_ type is found, following macros are passed as preprocessor constants to the compiler using the +type+ name, in uppercase. * 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X' is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP, where 'TYP' is the +type+ name in uppercase with replacing '_t' suffix with 'T', followed by '=X' where 'X' is the macro name to convert +type+ to +Integer+ object, and vice versa. For example, if foobar_t is defined as unsigned long, then convertible_int("foobar_t") would return "unsigned long", and define macros: #define TYPEOF_FOOBAR_T unsigned long #define FOOBART2NUM ULONG2NUM #define NUM2FOOBART NUM2ULONG
...Returns the convertible integer type of the given +type+. You may
optionally specify additional +headers+ to search in for the +type+.
_Convertible_ means actually same type, or typedefed from same type.
If the +type+ is a integer type and _convertible_ type is found,
following macros are p......mpiler using the +type+ name, in uppercase.
* 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X'
is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP,
where 'TYP' is the +type+ name in uppercase with replacing '_t'
suffix with 'T', followed by '=X' where 'X' is......the macro name to
convert +type+ to +Integer+ object, and vice versa.
For example, if foobar_t is defined as unsigned long, then
convertible_int("foobar_t") would return "unsigned long", and define
macros:
#define TYPEOF_FOOBAR_T unsigned long
#define FOOBART2NUM ULONG2NUM
#defin... -
Kernel
. # global _ variables -> [Symbol] (107.0) -
プログラム中で定義されているグローバル変数(`$'で始まる変数)名の 配列を返します。
...グラム中で定義されているグローバル変数(`$'で始まる変数)名の
配列を返します。
//emlist[例][ruby]{
p global_variables #=> [:$;, :$-F, :$@, ... ]
//}
@see Kernel.#local_variables,Object#instance_variables,Module.constants,Module#constants,Module#class_variables...