るりまサーチ

最速Rubyリファレンスマニュアル検索!
586件ヒット [1-100件を表示] (0.120秒)

別のキーワード

  1. object yield_self
  2. _builtin yield_self
  3. _builtin self
  4. tracepoint self
  5. codeobject document_self

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

RubyVM::InstructionSequence#to_a -> Array (27236.0)

self の情報を 14 要素の配列にして返します。

...
self
の情報を 14 要素の配列にして返します。

命令シーケンスを以下の情報で表します。

: magic

データフォーマットを示す文字列。常に
"YARVInstructionSequence/SimpleDataFormat"。

: major_version

命令シーケンスのメジャーバー...
...at_type

データフォーマットを示す数値。常に 1。

: misc

以下の要素から構成される Hash オブジェクト。

:arg_size: メソッド、ブロックが取る引数の総数(1 つもない場合は 0)。

:local_size: ローカル変数の総数 + 1。

:st...
...さ。(SystemStackError を検出するために使用)

: #label

メソッド名、クラス名、モジュール名などで構成される命令シーケンスのラ
ベル。トップレベルでは "<main>"。文字列から作成していた場合は
"<compiled>"。

: #path

命令...

Array#to_a -> Array (24248.0)

self を返します。ただし、Array のサブクラスのインスタンスに対して呼ばれた時は、 自身を Array に変換したものを返します。

...
self
を返します。ただし、Array のサブクラスのインスタンスに対して呼ばれた時は、
自身を Array に変換したものを返します。

//emlist[例][ruby]{
class SubArray < Array; end
ary1 = Array([1, 2, 3, 4])
ary2 = SubArray([1, 2, 3, 4])

ary1.to_a # =>...
...[1, 2, 3, 4]
ary1.to_a.class # => Array

ary2.to_a # => [1, 2, 3, 4]
ary2.to_a.class # => Array
//}

@see Array#to_ary...

Set#to_a -> Array (24230.0)

self を配列に変換します。要素の順序は不定です。

...self を配列に変換します。要素の順序は不定です。

//emlist[][ruby]{
require 'set'
set = Set['hello', 'world']
p set.to_a # => ["hello", "world"]
//}...
...self を配列に変換します。要素の順序は不定です。

//emlist[][ruby]{
set = Set['hello', 'world']
p set.to_a # => ["hello", "world"]
//}...

Range#to_a -> Array (21260.0)

self を配列に変換します。

...
self
を配列に変換します。

@raise RangeError 終端のない Range オブジェクトを変換しようとしたときに発生します。

//emlist[例][ruby]{
p (5..0).to_a # => []
p (0..3).to_a # => [0, 1, 2, 3]
p ('a'..'c').to_a # => ["a", "b", "c"]
p (:a..:d).to_a # => [...
...:a, :b, :c, :d]

require 'date'
p (Date.new(1965, 4, 14) .. Date.new(1965, 4, 14)).to_a # => [#<Date: 1965-04-14 ((2438865j,0s,0n),+0s,2299161j)>]

(1..).to_a # RangeError: cannot convert endless range to an array
//}...

Array#to_ary -> self (12330.0)

self をそのまま返します。

...
self
をそのまま返します。

//emlist[例][ruby]{
class SubArray < Array; end
ary1 = Array([1, 2, 3, 4])
ary2 = SubArray([1, 2, 3, 4])

ary1.to_ary # => [1, 2, 3, 4]
ary1.to_ary.class # => Array

ary2.to_ary # => [1, 2, 3, 4]
ary2.to_ary.class # => SubArray
//}

@see Array#t...

絞り込み条件を変える

Array#permutation(n = self.length) { |p| block } -> self (6358.0)

サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。

...成する Enumerator オブジェクトを返します。

@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。

@raise TypeError 引数に...
...st[例][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.permutati...
...(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 = [...

String#bytes {|byte| ... } -> self (6352.0)

文字列の各バイトを数値の配列で返します。(self.each_byte.to_a と同じです)

...列で返します。(self.each_byte.to_a と同じです)

//emlist[例][ruby]{
"str".bytes # => [115, 116, 114]
//}

ブロックが指定された場合は String#each_byte と同じように動作します。

Ruby
2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警告は削除...
...されました。

@see String#each_byte...

String#grapheme_clusters {|grapheme_cluster| block } -> self (6352.0)

文字列の書記素クラスタの配列を返します。(self.each_grapheme_cluster.to_a と同じです)

...す。(self.each_grapheme_cluster.to_a と同じです)

//emlist[例][ruby]{
"a\u0300".grapheme_clusters # => ["à"]
//}

ブロックが指定された場合は String#each_grapheme_cluster と同じように動作します。

Ruby
2.6 までは deprecated の警告が出ますが、Ruby 2.7 で...
...警告は削除されました。

@see String#each_grapheme_cluster...

String#each_grapheme_cluster {|grapheme_cluster| block } -> self (6320.0)

文字列の書記素クラスタに対して繰り返します。

...

String#each_char と違って、
Unicode Standard Annex #29 (https://unicode.org/reports/tr29/)
で定義された書記素クラスタに対して繰り返します。

//emlist[例][ruby]{
"a\u0300".each_char.to_a.size # => 2
"a\u0300".each_grapheme_cluster.to_a.size # => 1
//}

@see String#g...
...rapheme_clusters...

Array#permutation(n = self.length) -> Enumerator (6258.0)

サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。

...成する Enumerator オブジェクトを返します。

@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。

@raise TypeError 引数に...
...st[例][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.permutati...
...(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 = [...

絞り込み条件を変える

<< 1 2 3 ... > >>