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
b88ca625
Commit
b88ca625
authored
Sep 16, 2015
by
takahashim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix block variable in Hash#fetch
parent
e91b7d64
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
1 deletion
+2
-1
mrbgems/mruby-hash-ext/mrblib/hash.rb
mrbgems/mruby-hash-ext/mrblib/hash.rb
+1
-1
mrbgems/mruby-hash-ext/test/hash.rb
mrbgems/mruby-hash-ext/test/hash.rb
+1
-0
No files found.
mrbgems/mruby-hash-ext/mrblib/hash.rb
View file @
b88ca625
...
@@ -126,7 +126,7 @@ class Hash
...
@@ -126,7 +126,7 @@ class Hash
def
fetch
(
key
,
none
=
NONE
,
&
block
)
def
fetch
(
key
,
none
=
NONE
,
&
block
)
unless
self
.
key?
(
key
)
unless
self
.
key?
(
key
)
if
block
if
block
block
.
call
block
.
call
(
key
)
elsif
none
!=
NONE
elsif
none
!=
NONE
none
none
else
else
...
...
mrbgems/mruby-hash-ext/test/hash.rb
View file @
b88ca625
...
@@ -75,6 +75,7 @@ assert('Hash#fetch') do
...
@@ -75,6 +75,7 @@ assert('Hash#fetch') do
assert_equal
"feline"
,
h
.
fetch
(
"cat"
)
assert_equal
"feline"
,
h
.
fetch
(
"cat"
)
assert_equal
"mickey"
,
h
.
fetch
(
"mouse"
,
"mickey"
)
assert_equal
"mickey"
,
h
.
fetch
(
"mouse"
,
"mickey"
)
assert_equal
"minny"
,
h
.
fetch
(
"mouse"
){
"minny"
}
assert_equal
"minny"
,
h
.
fetch
(
"mouse"
){
"minny"
}
assert_equal
"mouse"
,
h
.
fetch
(
"mouse"
){
|
k
|
k
}
begin
begin
h
.
fetch
(
"gnu"
)
h
.
fetch
(
"gnu"
)
rescue
=>
e
rescue
=>
e
...
...
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