Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
e24b4a1e
Commit
e24b4a1e
authored
Jan 21, 2020
by
Hiroshi Mimaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete duplicated `Array#delete_if`.
parent
f7abda14
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
31 deletions
+0
-31
mrbgems/mruby-array-ext/mrblib/array.rb
mrbgems/mruby-array-ext/mrblib/array.rb
+0
-31
No files found.
mrbgems/mruby-array-ext/mrblib/array.rb
View file @
e24b4a1e
...
@@ -686,37 +686,6 @@ class Array
...
@@ -686,37 +686,6 @@ class Array
satisfied
?
low
:
nil
satisfied
?
low
:
nil
end
end
##
# call-seq:
# ary.delete_if { |item| block } -> ary
# ary.delete_if -> Enumerator
#
# Deletes every element of +self+ for which block evaluates to +true+.
#
# The array is changed instantly every time the block is called, not after
# the iteration is over.
#
# See also Array#reject!
#
# If no block is given, an Enumerator is returned instead.
#
# scores = [ 97, 42, 75 ]
# scores.delete_if {|score| score < 80 } #=> [97]
def
delete_if
(
&
block
)
return
to_enum
:delete_if
unless
block
idx
=
0
while
idx
<
self
.
size
do
if
block
.
call
(
self
[
idx
])
self
.
delete_at
(
idx
)
else
idx
+=
1
end
end
self
end
##
##
# call-seq:
# call-seq:
# ary.keep_if { |item| block } -> ary
# ary.keep_if { |item| block } -> ary
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment