るりまサーチ

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

別のキーワード

  1. kernel $-l
  2. matrix l
  3. _builtin $-l
  4. lupdecomposition l
  5. l matrix

ライブラリ

検索結果

Set#reject! {|o| ... } -> self | nil (18221.0)

集合の各要素に対してブロックを実行し、その結果が真であるようなすべての 要素を削除します。

...elete_if は常に self を返します。

reject!
は、要素が 1 つ以上削除されれば self を、1 つも削除されなければ
nil を返します。

//emlist[][ruby]{
require 'set'
s1 = Set['hello.rb', 'test.rb', 'hello.rb.bak']
s1.delete_if {|str| str =~ /\.bak\z/}
p s1 # => #<Set:...
...{"hello.rb", "test.rb"}>

s2 = Set['hello.rb', 'test.rb', 'hello.rb.bak']
p s2.reject! {|str| str =~ /\.bak\z/} # => #<Set: {"hello.rb", "test.rb"}>
p s2.reject! {|str| str =~ /\.o\z/} # => nil
//}

@see Enumerable#reject...

Set#delete_if {|o| ... } -> self (6121.0)

集合の各要素に対してブロックを実行し、その結果が真であるようなすべての 要素を削除します。

...elete_if は常に self を返します。

reject!
は、要素が 1 つ以上削除されれば self を、1 つも削除されなければ
nil を返します。

//emlist[][ruby]{
require 'set'
s1 = Set['hello.rb', 'test.rb', 'hello.rb.bak']
s1.delete_if {|str| str =~ /\.bak\z/}
p s1 # => #<Set:...
...{"hello.rb", "test.rb"}>

s2 = Set['hello.rb', 'test.rb', 'hello.rb.bak']
p s2.reject! {|str| str =~ /\.bak\z/} # => #<Set: {"hello.rb", "test.rb"}>
p s2.reject! {|str| str =~ /\.o\z/} # => nil
//}

@see Enumerable#reject...