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
71f2975a
Commit
71f2975a
authored
Aug 20, 2015
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2921 from gkta/refactor-array
array.rb: refactor some code
parents
05625cd6
c326f065
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
11 deletions
+6
-11
mrblib/array.rb
mrblib/array.rb
+6
-11
No files found.
mrblib/array.rb
View file @
71f2975a
...
...
@@ -16,7 +16,7 @@ class Array
while
idx
<
length
and
length
<=
self
.
length
and
length
=
self
.
length
-
1
elm
=
self
[
idx
+=
1
]
unless
elm
if
elm
==
nil
and
length
>=
self
.
length
if
elm
.
nil?
and
length
>=
self
.
length
break
end
end
...
...
@@ -50,9 +50,7 @@ class Array
def
collect!
(
&
block
)
return
to_enum
:collect!
unless
block_given?
self
.
each_index
{
|
idx
|
self
[
idx
]
=
block
.
call
(
self
[
idx
])
}
self
.
each_index
{
|
idx
|
self
[
idx
]
=
block
.
call
(
self
[
idx
])
}
self
end
...
...
@@ -72,7 +70,7 @@ class Array
self
.
clear
if
size
>
0
self
[
size
-
1
]
=
nil
# allocate
self
[
size
-
1
]
=
nil
# allocate
idx
=
0
while
idx
<
size
...
...
@@ -158,14 +156,11 @@ class Array
len
=
self
.
size
n
=
other
.
size
if
len
>
n
len
=
n
end
len
=
n
if
len
>
n
i
=
0
while
i
<
len
n
=
(
self
[
i
]
<=>
other
[
i
])
return
n
if
n
==
nil
return
n
if
n
!=
0
return
n
if
n
.
nil?
||
n
!=
0
i
+=
1
end
len
=
self
.
size
-
other
.
size
...
...
@@ -185,7 +180,7 @@ class Array
self
.
delete_at
(
i
)
ret
=
key
end
if
ret
==
nil
&&
block
if
ret
.
nil?
&&
block
block
.
call
else
ret
...
...
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