505件ヒット
[1-100件を表示]
(0.357秒)
ライブラリ
- ビルトイン (505)
クラス
-
ARGF
. class (22) - Array (77)
- Enumerator (44)
-
Enumerator
:: Lazy (11) - Hash (22)
- MatchData (11)
- Object (33)
- Range (12)
- Regexp (22)
-
RubyVM
:: InstructionSequence (11) - String (69)
- Struct (22)
モジュール
- Enumerable (149)
キーワード
- bytes (22)
- chain (6)
- chars (11)
- chunk (11)
-
chunk
_ while (11) - codepoints (11)
- combination (22)
- each (44)
-
each
_ byte (22) -
each
_ codepoint (11) -
each
_ grapheme _ cluster (7) - entries (17)
- force (11)
-
grapheme
_ clusters (7) - keys (11)
- match (22)
-
max
_ by (44) - permutation (11)
-
repeated
_ combination (22) - sample (22)
-
slice
_ after (22) -
slice
_ before (22) -
slice
_ when (11) - tap (11)
-
to
_ ary (11) - values (22)
-
values
_ at (11)
検索結果
先頭5件
-
Object
# to _ a -> Array (29119.0) -
オブジェクトを配列に変換した結果を返します。 デフォルトでは定義されていません。
...のメソッドは実際には Object クラスには定義されていません。
必要に応じてサブクラスで定義すべきものです。
//emlist[][ruby]{
p( {'a'=>1}.to_a ) # [["a", 1]]
p ['array'].to_a # ["array"]
p nil.to_a # []
//}
@see Object#to_ary,Kernel.#Array... -
RubyVM
:: InstructionSequence # to _ a -> Array (29107.0) -
self の情報を 14 要素の配列にして返します。
...:local_size: ローカル変数の総数 + 1。
:stack_max: スタックの深さ。(SystemStackError を検出するために使用)
: #label
メソッド名、クラス名、モジュール名などで構成される命令シーケンスのラ
ベル。トップレベルでは "<ma......合は "<compiled>"。
: #absolute_path
命令シーケンスの絶対パス。文字列から作成していた場合は nil。
: #first_lineno
命令シーケンスの 1 行目の行番号。
: type
命令シーケンスの種別。
:top、:method、:block、:class、:rescue、:ensur......数名からなる Symbol の配列。
: args
引数の指定が必須のメソッド、ブロックの引数の個数。あるいは以下のよう
な配列。
[required_argc, [optional_arg_labels, ...],
splat_index, post_splat_argc, post_splat_index,
block_index, simple]... -
Enumerable
# to _ a(*args) -> [object] (26225.0) -
全ての要素を含む配列を返します。
...@param args each の呼び出し時に引数として渡されます。
//emlist[例][ruby]{
(1..7).to_a #=> [1, 2, 3, 4, 5, 6, 7]
{ 'a'=>1, 'b'=>2, 'c'=>3 }.to_a #=> [["a", 1], ["b", 2], ["c", 3]]
require 'prime'
Prime.entries 10 #=> [2, 3, 5, 7]
//}... -
Struct
# to _ a -> [object] (26207.0) -
構造体のメンバの値を配列にいれて返します。
...構造体のメンバの値を配列にいれて返します。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345).to_a
# => ["Joe Smith", "123 Maple, Anytown NC", 12345]
//}
[注意] 本メソッドの記述は Struct の下... -
Range
# to _ a -> Array (23149.0) -
self を配列に変換します。
...][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 # R... -
Object
# to _ ary -> Array (17106.0) -
オブジェクトの Array への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。
...す。
デフォルトでは定義されていません。
説明のためここに記載してありますが、
このメソッドは実際には Object クラスには定義されていません。
必要に応じてサブクラスで定義すべきものです。
このメソッドを定義す......すべての場面で代置可能であるような、
* 配列そのものとみなせるようなもの
という厳しいものになっています。
//emlist[][ruby]{
class Foo
def to_ary
[3,4]
end
end
it = Foo.new
p([1,2] + it) #=> [1, 2, 3, 4]
//}
@see Object#to_a,Kernel.#Array... -
String
# bytes {|byte| . . . } -> self (14216.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... -
ARGF
. class # each _ byte { |byte| . . . } -> self (14206.0) -
ARGF の現在位置から 1 バイトずつ読み込み、それを整数として与え、ブロックを実行します。 ブロック引数byteは0..255のいずれかの整数です。
...込み、それを整数として与え、ブロックを実行します。
ブロック引数byteは0..255のいずれかの整数です。
このメソッドはスクリプトに指定した引数(Object::ARGV を参照) をファ
イル名とみなして、それらのファイルを連結した......現在位置の1バイトについてファイル名を得るには
ARGF.class#filename を使用します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを生成して返します。
例:
ARGF.each_byte.to_a # => [35, 32, ... 95, 10]
@see IO#each_byte... -
Array
# combination(n) -> Enumerator (14136.0) -
サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。
...uby]{
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.comb......ination(5).to_a #=> [] : no combinations of length 5
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3, 4]
result = []
a.combination(2) {|e| result << e} # => [1,2,3,4]......result #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
//}
@see Array#permutation, Array#repeated_combination... -
Array
# combination(n) {|c| block } -> self (14136.0) -
サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。
...uby]{
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.comb......ination(5).to_a #=> [] : no combinations of length 5
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3, 4]
result = []
a.combination(2) {|e| result << e} # => [1,2,3,4]......result #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
//}
@see Array#permutation, Array#repeated_combination...