るりまサーチ

最速Rubyリファレンスマニュアル検索!
451件ヒット [1-100件を表示] (0.075秒)
トップページ > クエリ:-[x] > クエリ:NIL[x] > クエリ:to_a[x] > ライブラリ:ビルトイン[x]

別のキーワード

  1. _builtin nil?
  2. object nil?
  3. nilclass nil?
  4. object nil
  5. _builtin nil

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

NilClass#to_a -> Array (21215.0)

空配列 [] を返します。

...空配列 [] を返します。

//emlist[例][ruby]{
nil
.to_a #=> []
//}...

Object#to_a -> Array (18227.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 (18227.0)

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

...作成していた場合は "<compiled>"。

: #absolute_path

命令シーケンスの絶対パス。文字列から作成していた場合は nil

: #first_lineno

命令シーケンスの 1 行目の行番号。

: type

命令シーケンスの種別。
:top、:method、:block、:cla...
...M::InstructionSequence.compile('num = 1 + 2')
pp iseq.to_a
# ※ Ruby 2.5.0 での実行結果
# => ["YARVInstructionSequence/SimpleDataFormat",
# 2,
# 0,
# 1,
# {:arg_size=>0, :local_size=>2, :stack_max=>2},
# "<compiled>",
# "<compiled>",
# nil,
# 1,
# :top,
# [:num],
# 0,
# [],
# [1,
# [:trace,...
...1],
# [:putobject_OP_INT2FIX_O_1_C_],
# [:putobject, 2],
# [:opt_plus, {:mid=>:+, :flag=>256, :orig_argc=>1, :blockptr=>nil}],
# [:dup],
# [:setlocal_OP__WC__0, 2],
# [:leave]]]
//}...

MatchData#to_a -> [String] (18215.0)

$&, $1, $2,... を格納した配列を返します。

...$&, $1, $2,... を格納した配列を返します。

//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.to_a # => ["foobar", "foo", "bar", nil]
//}

@see MatchData#captures...

ARGF.class#to_a(limit) -> Array (15221.0)

ARGFの各行を配列に読み込んで返します。rsがnilの場合は要素に各ファイルを すべて読み込んだ配列を返します。

...ARGFの各行を配列に読み込んで返します。rsがnilの場合は要素に各ファイルを
すべて読み込んだ配列を返します。

@param rs 行区切り文字

@param limit 最大の読み込みバイト数

lines = ARGF.readlines
lines[0] # => "This is lin...

絞り込み条件を変える

ARGF.class#to_a(rs = $/) -> Array (15221.0)

ARGFの各行を配列に読み込んで返します。rsがnilの場合は要素に各ファイルを すべて読み込んだ配列を返します。

...ARGFの各行を配列に読み込んで返します。rsがnilの場合は要素に各ファイルを
すべて読み込んだ配列を返します。

@param rs 行区切り文字

@param limit 最大の読み込みバイト数

lines = ARGF.readlines
lines[0] # => "This is lin...

ARGF.class#to_a(rs, limit) -> Array (15221.0)

ARGFの各行を配列に読み込んで返します。rsがnilの場合は要素に各ファイルを すべて読み込んだ配列を返します。

...ARGFの各行を配列に読み込んで返します。rsがnilの場合は要素に各ファイルを
すべて読み込んだ配列を返します。

@param rs 行区切り文字

@param limit 最大の読み込みバイト数

lines = ARGF.readlines
lines[0] # => "This is lin...

Regexp#match(str, pos = 0) -> MatchData | nil (292.0)

指定された文字列 str に対して位置 pos から自身が表す正規表現によるマッ チングを行います。マッチした場合には結果を MatchData オブジェクトで返し ます。 マッチしなかった場合 nil を返します。

... nil を返します。

省略可能な第二引数 pos を指定すると、マッチの開始位置を pos から行
うよう制御できます(pos のデフォルト値は 0)。

//emlist[例][ruby]{
p(/(.).(.)/.match("foobar", 3).captures) # => ["b", "r"]
p(/(.).(.)/.match("foobar", -3).c...
...# => ["b", "r"]
//}

pos を指定しても MatchData#offset 等の結果
には影響しません。つまり、
//emlist[][ruby]{
re.match(str[pos..-1])
//}

//emlist[][ruby]{
re.match(str, pos)
//}
は異なります。


ブロックを渡すと、マッチした場合に限り MatchData オ...
...ブロックの値を返し、マッチしなかった場合は nil を返します。

//emlist[例][ruby]{
results = []
/((.)\2)/.match("foo") {|m| results << m[0] } # => ["oo"]
/((.)\2)/.match("bar") {|m| results << m[0] } # => nil
results # => ["oo"]
//}

@param str 文字列を指定します...

Regexp#match(str, pos = 0) {|m| ... } -> object | nil (292.0)

指定された文字列 str に対して位置 pos から自身が表す正規表現によるマッ チングを行います。マッチした場合には結果を MatchData オブジェクトで返し ます。 マッチしなかった場合 nil を返します。

... nil を返します。

省略可能な第二引数 pos を指定すると、マッチの開始位置を pos から行
うよう制御できます(pos のデフォルト値は 0)。

//emlist[例][ruby]{
p(/(.).(.)/.match("foobar", 3).captures) # => ["b", "r"]
p(/(.).(.)/.match("foobar", -3).c...
...# => ["b", "r"]
//}

pos を指定しても MatchData#offset 等の結果
には影響しません。つまり、
//emlist[][ruby]{
re.match(str[pos..-1])
//}

//emlist[][ruby]{
re.match(str, pos)
//}
は異なります。


ブロックを渡すと、マッチした場合に限り MatchData オ...
...ブロックの値を返し、マッチしなかった場合は nil を返します。

//emlist[例][ruby]{
results = []
/((.)\2)/.match("foo") {|m| results << m[0] } # => ["oo"]
/((.)\2)/.match("bar") {|m| results << m[0] } # => nil
results # => ["oo"]
//}

@param str 文字列を指定します...

MatchData#[](n) -> String | nil (243.0)

n 番目の部分文字列を返します。

...(末尾の
要素が -1 番目)。n 番目の要素が存在しない時には nil を返します。

@param n 返す部分文字列のインデックスを指定します。

//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.to_a # => ["foobar", "foo", "bar", nil]
p $~[0] #...
...=> "foobar"
p $~[1] # => "foo"
p $~[2] # => "bar"
p $~[3] # => nil (マッチしていない)
p $~[4] # => nil (範囲外)
p $~[-2] # => "bar"
//}...

絞り込み条件を変える

<< 1 2 3 ... > >>