D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Hash
/
Filename :
keep_if-i.ri
back
Copy
U:RDoc::AnyMethod[iI"keep_if:ETI"Hash#keep_if;TF:publico:RDoc::Markup::Document:@parts[ o:RDoc::Markup::Paragraph; [I".Calls the block for each key-value pair; ;TI"<retains the entry if the block returns a truthy value; ;TI"1otherwise deletes the entry; returns +self+.;To:RDoc::Markup::Verbatim; [I""h = {foo: 0, bar: 1, baz: 2} ;TI"Mh.keep_if { |key, value| key.start_with?('b') } # => {:bar=>1, :baz=>2} ;T:@format0o; ; [I"0Returns a new Enumerator if no block given:;To;; [I""h = {foo: 0, bar: 1, baz: 2} ;TI"Ke = h.keep_if # => #<Enumerator: {:foo=>0, :bar=>1, :baz=>2}:keep_if> ;TI"Ie.each { |key, value| key.start_with?('b') } # => {:bar=>1, :baz=>2};T;0: @fileI"hash.c;T:0@omit_headings_from_table_of_contents_below0I"Mhash.keep_if {|key, value| ... } -> self hash.keep_if -> new_enumerator ;T0[ I"();T@FI" Hash;TcRDoc::NormalClass00