るりまサーチ

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

別のキーワード

  1. _builtin to_r
  2. open3 pipeline_r
  3. matrix elements_to_r
  4. fileutils chown_r
  5. bigdecimal to_r

ライブラリ

クラス

検索結果

MatchData#deconstruct -> [String] (24416.0)

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

...応する要素は nil になります。

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

@
see MatchData#to_a, MatchData#named_captures, d:spec/pattern_matching#matching_non_primitive_objects...