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
0bb7f5e9
Commit
0bb7f5e9
authored
Mar 15, 2014
by
ksss
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix variable name typo
parent
9447c637
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
mrbgems/mruby-enumerator/mrblib/enumerator.rb
mrbgems/mruby-enumerator/mrblib/enumerator.rb
+1
-1
mrbgems/mruby-enumerator/test/enumerator.rb
mrbgems/mruby-enumerator/test/enumerator.rb
+15
-0
No files found.
mrbgems/mruby-enumerator/mrblib/enumerator.rb
View file @
0bb7f5e9
...
@@ -206,7 +206,7 @@ class Enumerator
...
@@ -206,7 +206,7 @@ class Enumerator
# # => foo:2
# # => foo:2
#
#
def
with_object
object
def
with_object
object
return
to_enum
:with_object
,
o
ffse
t
unless
block_given?
return
to_enum
:with_object
,
o
bjec
t
unless
block_given?
each
do
|
i
|
each
do
|
i
|
yield
[
i
,
object
]
yield
[
i
,
object
]
...
...
mrbgems/mruby-enumerator/test/enumerator.rb
View file @
0bb7f5e9
...
@@ -72,6 +72,21 @@ assert 'Enumerator#with_object' do
...
@@ -72,6 +72,21 @@ assert 'Enumerator#with_object' do
assert_equal
([
55
,
3628800
],
ret
)
assert_equal
([
55
,
3628800
],
ret
)
end
end
assert
'Enumerator#with_object arguments'
do
to_three
=
Enumerator
.
new
do
|
y
|
3
.
times
do
|
x
|
y
<<
x
end
end
a
=
[]
to_three_with_string
=
to_three
.
with_object
(
"foo"
)
to_three_with_string
.
each
do
|
x
,
string
|
a
<<
"
#{
string
}
:
#{
x
}
"
end
assert_equal
[
"foo:0"
,
"foo:1"
,
"foo:2"
],
a
end
assert
'Enumerator#inspect'
do
assert
'Enumerator#inspect'
do
e
=
(
0
..
10
).
each
e
=
(
0
..
10
).
each
assert_equal
(
"#<Enumerator: 0..10:each>"
,
e
.
inspect
)
assert_equal
(
"#<Enumerator: 0..10:each>"
,
e
.
inspect
)
...
...
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