685件ヒット
[1-100件を表示]
(0.326秒)
種類
- インスタンスメソッド (550)
- モジュール関数 (88)
- 特異メソッド (36)
- クラス (11)
クラス
モジュール
- Kernel (88)
キーワード
- % (11)
- * (22)
- Integer (11)
- Numeric (11)
- [] (33)
- []= (22)
- at (11)
- begin (11)
- combination (22)
- cycle (22)
-
delete
_ at (11) - end (11)
- fetch (33)
- first (33)
- flatten (11)
- flatten! (11)
- format (11)
- insert (11)
- last (33)
- new (33)
- permutation (22)
- pop (11)
-
public
_ method (11) - putc (11)
- rand (55)
-
repeated
_ combination (22) -
repeated
_ permutation (22) - rotate (11)
- rotate! (11)
- sample (44)
- shift (11)
- sprintf (11)
- srand (22)
-
to
_ i (11) -
try
_ convert (3)
検索結果
先頭5件
-
Numeric
# to _ int -> Integer (29215.0) -
self.to_i と同じです。
...self.to_i と同じです。
//emlist[例][ruby]{
(2+0i).to_int # => 2
Rational(3).to_int # => 3
//}... -
Object
# to _ int -> Integer (29209.0) -
オブジェクトの Integer への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。
...オブジェクトの Integer への暗黙の変換が必要なときに内部で呼ばれます。
デフォルトでは定義されていません。
説明のためここに記載してありますが、
このメソッドは実際には Object クラスには定義されていません。
必......が使われるすべての場面で代置可能であるような、
* 整数そのものとみなせるようなもの
という厳しいものになっています。
//emlist[][ruby]{
class Foo
def to_int
1
end
end
ary = [:a, :b, :c]
p(ary[Foo.new]) # => :b
//}
@see Kernel.#Integer... -
Integer
# to _ int -> self (26203.0) -
self を返します。
...self を返します。
//emlist[][ruby]{
10.to_i # => 10
//}... -
Kernel
. # Integer(arg , base = 0) -> Integer (17220.0) -
引数を整数(Fixnum,Bignum)に変換した結果を返します。
...変換します。
数値と文字列以外のオブジェクトに対しては arg.to_int, arg.to_i を
この順に使用して変換します。
@param arg 変換対象のオブジェクトです。
@param base 基数として0か2から36の整数を指定します(引数argに文字列を指......数) です。
@raise ArgumentError 整数と見なせない文字列を引数に指定した場合に発生します。
@raise TypeError メソッド to_int, to_i を持たないオブジェクトを引数に指定したか、to_int, to_i
が整数(Integerのサブクラス)を返さ......@raise TypeError 引数に nil を指定した場合に発生します。
//emlist[例][ruby]{
p Integer(4) #=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9
p Integer(nil) # can't convert nil into Integer (TypeError)
p Integer(Object.new) # cannot convert Object in... -
Kernel
. # Integer(arg , base = 0 , exception: true) -> Integer | nil (17220.0) -
引数を整数(Fixnum,Bignum)に変換した結果を返します。
...変換します。
数値と文字列以外のオブジェクトに対しては arg.to_int, arg.to_i を
この順に使用して変換します。
@param arg 変換対象のオブジェクトです。
@param base 基数として0か2から36の整数を指定します(引数argに文字列を指......@param exception false を指定すると、変換できなかった場合、
例外を発生する代わりに nil を返します。
@raise ArgumentError 整数と見なせない文字列を引数に指定した場合に発生します。
@raise TypeError メソッド to_int, to_......、to_int, to_i
が整数(Integerのサブクラス)を返さなかった場合に発生します。
@raise TypeError 引数に nil を指定した場合に発生します。
//emlist[例][ruby]{
p Integer(4) #=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9
p Integer(nil... -
Integer
. try _ convert(obj) -> Integer | nil (14230.0) -
obj を Integer に変換しようと試みます。変換には Object#to_int メソッドが使われます。
...Integer に変換しようと試みます。変換には Object#to_int
メソッドが使われます。
Integer ならそのままobjを返します。
そうでなければ obj.to_int の結果を返すか、nil が返されます。
@param obj 変換する任意のオブジェクト
@return......Integer または nil
@raise TypeError to_int が Integer を返さなかった場合に発生します。
//emlist[例][ruby]{
Integer.try_convert(1) # => 1
Integer.try_convert(1.25) # => 1
Integer.try_convert([]) # => nil
//}... -
Array
# permutation(n = self . length) -> Enumerator (14220.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...生成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......//emlist[例][ruby]{
a = [1, 2, 3]
a.permutation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(1).to_a #=> [[1],[2],[3]]
a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.per......e permutation of length 0
a.permutation(4).to_a #=> [] : no permutations of length 4
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.permutation(2) {|e... -
Object
# public _ method(name) -> Method (14214.0) -
オブジェクトの public メソッド name をオブジェクト化した Method オブジェクトを返します。
...lic メソッド name をオブジェクト化した
Method オブジェクトを返します。
@param name メソッド名を Symbol または String で指定します。
@raise NameError 定義されていないメソッド名や、
protected メソッド名、 private メソッド名を......引数として与えると発生します。
//emlist[][ruby]{
1.public_method(:to_int) #=> #<Method: Integer#to_int>
1.public_method(:p) # method `p' for class `Integer' is private (NameError)
//}
@see Object#method,Object#public_send,Module#public_instance_method... -
Array
# permutation(n = self . length) { |p| block } -> self (14120.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...生成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......//emlist[例][ruby]{
a = [1, 2, 3]
a.permutation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(1).to_a #=> [[1],[2],[3]]
a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.per......e permutation of length 0
a.permutation(4).to_a #=> [] : no permutations of length 4
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.permutation(2) {|e... -
Array
# repeated _ combination(n) -> Enumerator (14120.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...成する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......を
指定した場合に発生します。
//emlist[例][ruby]{
a = [1, 2, 3]
a.repeated_combination(1).to_a #=> [[1], [2], [3]]
a.repeated_combination(2).to_a #=> [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]
a.repeated_combination(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],......3],[3,3,3]]
a.repeated_combination(4).to_a #=> [[1,1,1,1],[1,1,1,2],[1,1,1,3],[1,1,2,2],[1,1,2,3],
# [1,1,3,3],[1,2,2,2],[1,2,2,3],[1,2,3,3],[1,3,3,3],
# [2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]]
a.repeated_combination(0... -
Array
# repeated _ combination(n) { |c| . . . } -> self (14120.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...成する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......を
指定した場合に発生します。
//emlist[例][ruby]{
a = [1, 2, 3]
a.repeated_combination(1).to_a #=> [[1], [2], [3]]
a.repeated_combination(2).to_a #=> [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]
a.repeated_combination(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],......3],[3,3,3]]
a.repeated_combination(4).to_a #=> [[1,1,1,1],[1,1,1,2],[1,1,1,3],[1,1,2,2],[1,1,2,3],
# [1,1,3,3],[1,2,2,2],[1,2,2,3],[1,2,3,3],[1,3,3,3],
# [2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]]
a.repeated_combination(0...