409件ヒット
[1-100件を表示]
(0.105秒)
別のキーワード
種類
- インスタンスメソッド (340)
- 文書 (69)
ライブラリ
- ビルトイン (307)
- pathname (11)
- prettyprint (11)
-
webrick
/ server (11)
クラス
モジュール
- Enumerable (66)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
NEWS for Ruby 3
. 1 . 0 (3) -
backtrace
_ locations (22) -
bit
_ length (17) - bytesplice (4)
-
chunk
_ while (11) - combination (22)
- fill (22)
- group (11)
-
max
_ by (44) - permutation (22)
-
repeated
_ combination (22) -
repeated
_ permutation (22) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 3 feature (11) -
ruby 1
. 8 . 4 feature (11) -
ruby 1
. 9 feature (11) - sample (22)
- size (22)
-
slice
_ when (11) -
sort
_ by! (22) - tokens (11)
- truncate (11)
- 制御構造 (11)
検索結果
先頭5件
-
Symbol
# length -> Integer (24225.0) -
シンボルに対応する文字列の長さを返します。
...シンボルに対応する文字列の長さを返します。
(self.to_s.length と同じです。)
:foo.length #=> 3
@see String#length, String#size... -
MatchData
# length -> Integer (24217.0) -
部分文字列の数を返します(self.to_a.size と同じです)。
...部分文字列の数を返します(self.to_a.size と同じです)。
//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.size # => 4
//}... -
Fixnum
# bit _ length -> Integer (12319.0) -
self を表すのに必要なビット数を返します。
...
self を表すのに必要なビット数を返します。
「必要なビット数」とは符号ビットを除く最上位ビットの位置の事を意味しま
す。2**n の場合は n+1 になります。self にそのようなビットがない(0 や
-1 である)場合は 0 を返しま......ceil(log2(int < 0 ? -int : int+1)) と同じ結果
(-2**12-1).bit_length # => 13
(-2**12).bit_length # => 12
(-2**12+1).bit_length # => 12
-0x101.bit_length # => 9
-0x100.bit_length # => 8
-0xff.bit_length # => 8
-2.bit_length......it_length # => 0
0.bit_length # => 0
1.bit_length # => 1
0xff.bit_length # => 8
0x100.bit_length # => 9
(2**12-1).bit_length # => 12
(2**12).bit_length # => 13
(2**12+1).bit_length # => 13
@see Bignum#bit... -
Integer
# bit _ length -> Integer (12313.0) -
self を表すのに必要なビット数を返します。
...
self を表すのに必要なビット数を返します。
「必要なビット数」とは符号ビットを除く最上位ビットの位置の事を意味しま
す。2**n の場合は n+1 になります。self にそのようなビットがない(0 や
-1 である)場合は 0 を返しま......//emlist[例: ceil(log2(int < 0 ? -int : int+1)) と同じ結果][ruby]{
(-2**12-1).bit_length # => 13
(-2**12).bit_length # => 12
(-2**12+1).bit_length # => 12
-0x101.bit_length # => 9
-0x100.bit_length # => 8
-0xff.bit_length # => 8
-2.bit_length......# => 1
-1.bit_length # => 0
0.bit_length # => 0
1.bit_length # => 1
0xff.bit_length # => 8
0x100.bit_length # => 9
(2**12-1).bit_length # => 12
(2**12).bit_length # => 13
(2**12+1).bit_length # => 13
//}
@see Integer#size... -
Bignum
# bit _ length -> Integer (12301.0) -
self を表すのに必要なビット数を返します。
...
self を表すのに必要なビット数を返します。
「必要なビット数」とは符号ビットを除く最上位ビットの位置の事を意味しま
す。2**n の場合は n+1 になります。self にそのようなビットがない(0 や
-1 である)場合は 0 を返しま......int < 0 ? -int : int+1)) と同じ結果
(-2**10000-1).bit_length # => 10001
(-2**10000).bit_length # => 10000
(-2**10000+1).bit_length # => 10000
(-2**1000-1).bit_length # => 1001
(-2**1000).bit_length # => 1000
(-2**1000+1).bit_length # => 1000
(2**1000-1).bit_......length # => 1000
(2**1000).bit_length # => 1001
(2**1000+1).bit_length # => 1001
(2**10000-1).bit_length # => 10000
(2**10000).bit_length # => 10001
(2**10000+1).bit_length # => 10001
@see Fixnum#bit_length... -
Array
# permutation(n = self . length) { |p| block } -> self (6423.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に......rmutation(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.permutation(0).to_a #=> [[]]: one 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| result << e} # => [1,2,3]
result # => [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
//}
@see Array#combination, Array#repeated_permutation... -
Array
# permutation(n = self . length) -> Enumerator (6323.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に......rmutation(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.permutation(0).to_a #=> [[]]: one 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| result << e} # => [1,2,3]
result # => [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
//}
@see Array#combination, Array#repeated_permutation... -
Thread
# backtrace _ locations(start = 0 , length = nil) -> [Thread :: Backtrace :: Location] | nil (6313.0) -
スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。
...トレースを Thread::Backtrace::Location の配
列で返します。
引数で指定した値が範囲外の場合、スレッドがすでに終了している場合は nil
を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフ......locations と似ていますが、本メソッドは self に限定
した情報を返します。
//emlist[例][ruby]{
thread = Thread.new { sleep 1 }
thread.run
thread.backtrace_locations # => ["/path/to/test.rb:1:in `sleep'", "/path/to/test.rb:1:in `block in <main>'"]
//}
@see Thread::Backtrace......::Location... -
Pathname
# truncate(length) -> 0 (6239.0) -
File.truncate(self.to_s, length) と同じです。
...File.truncate(self.to_s, length) と同じです。
@param length 変更したいサイズを整数で与えます。
@see File.truncate... -
String
# bytesplice(index , length , str) -> String (6229.0) -
self の一部または全部を str で置き換えて str を返します。
...
self の一部または全部を str で置き換えて str を返します。
置き換え範囲の指定は、長さの指定が省略できないこと以外は
String#byteslice と同じです。
置き換え後の文字列の長さが対象の長さと違う場合、
適切に長さが調整......。
@param index 置換したい文字列の範囲の始端
@param length 置換したい文字列の範囲の長さ
@param range 置換したい文字列の範囲を示す Range オブジェクト
@raise IndexError index や length が範囲外の場合に発生
@raise RangeError range が範囲......外の場合に発生
@raise IndexError 指定した始端や終端が文字列の境界と一致しない場合に発生
@see String#byteslice... -
Array
# combination(n) {|c| block } -> self (6219.0) -
サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。
...成する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......st[例][ruby]{
a = [1, 2, 3, 4]
a.combination(1).to_a #=> [[1],[2],[3],[4]]
a.combination(2).to_a #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
a.combination(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
a.combination(4).to_a #=> [[1,2,3,4]]
a.combination(0).to_a #=> [[]]: one combination of length......0
a.combination(5).to_a #=> [] : no combinations of length 5
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3, 4]
result = []
a.combination(2) {|e| result << e} # =>... -
Array
# repeated _ combination(n) { |c| . . . } -> self (6213.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...成する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......peated_combination(0).to_a #=> [[]] # one combination of length 0
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.repeated_combination(3) {|e| result <<......e} # => [1,2,3]
result #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],
# [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]
//}
@see Array#repeated_permutation, Array#combination...