るりまサーチ

最速Rubyリファレンスマニュアル検索!
26件ヒット [1-26件を表示] (0.087秒)
トップページ > クエリ:i[x] > クエリ:instance[x] > クエリ:grep[x]

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. _builtin $-i
  5. _builtin i

ライブラリ

クラス

モジュール

キーワード

検索結果

Enumerable#grep(pattern) {|item| ... } -> [object] (18232.0)

pattern === item が成立する要素を全て含んだ配列を返します。

...pattern === item が成立する要素を全て含んだ配列を返します。

ブロックとともに呼び出された時には条件の成立した要素に対して
それぞれブロックを評価し、その結果の配列を返します。
マッチする要素がひとつもなかっ...
...返します。

@param pattern 「===」メソッドを持つオブジェクトを指定します。

//emlist[例][ruby]{
['aa', 'bb', 'cc', 'dd', 'ee'].grep(/[bc]/) # => ["bb", "cc"]

Array.instance_methods.grep(/gr/) # => [:grep, :group_by]
//}

@see Enumerable#select
@see Enumerable#grep_v...

NEWS for Ruby 3.0.0 (42.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...positional arguments.
Code that resulted in deprecation warnings in Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now matches the behavior of Procs
accepting...
...tion shows the help message via the pager designated by the value.
16754

=== `--backtrace-limit` option

The `--backtrace-limit` option limits the maximum length of a backtrace.
8661

== Core classes updates

Outstanding ones only.

* Array
* The following methods now return Array instances i...
...da's arity check.
* When writing to STDOUT redirected to a closed pipe, no broken pipe error message will be shown now. 14413
* `TRUE`/`FALSE`/`NIL` constants are no longer defined.
* Integer#zero? overrides Numeric#zero? for optimization. 16961
* Enumerable#grep and Enumerable#grep_v when...

Object#===(other) -> bool (30.0)

case 式で使用されるメソッドです。d:spec/control#case も参照してください。

...Enumerable#grep でも使用されます。

@param other 比較するオブジェクトです。

//emlist[][ruby]{
age = 12
# (0..2).===(12), (3..6).===(12), ... が実行される
result =
case age
when 0 .. 2
"baby"
when 3 .. 6
"little child"
when 7 .. 12
"child"
when 13 ....
...lt #=> "child"

def check arg
case arg
when /ruby(?!\s*on\s*rails)/i
"hit! #{arg}"
when String
"Instance of String class. But don't hit."
else
"unknown"
end
end

puts check([]) #=> unknown
puts check("mash-up in Ruby on Rails") #=> instance of String class. But not hit...
puts...
...check("<Ruby's world>") #=> hit! <Ruby's world>
//}

@see Object#==, Range#===, Module#===, Regexp#===, Enumerable#grep...