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
012c32ad
Commit
012c32ad
authored
May 10, 2014
by
Jun Hiroe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add comments to Hash methods
parent
adea2ca3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
4 deletions
+50
-4
mrblib/hash.rb
mrblib/hash.rb
+50
-4
No files found.
mrblib/hash.rb
View file @
012c32ad
...
...
@@ -205,7 +205,16 @@ class Hash
# ISO 15.2.13.4.31 (x)
alias
to_s
inspect
# 1.8/1.9 Hash#reject! returns Hash; ISO says nothing.
##
# call-seq:
# hsh.reject! {| key, value | block } -> hsh or nil
# hsh.reject! -> an_enumerator
#
# Equivalent to <code>Hash#delete_if</code>, but returns
# <code>nil</code> if no changes were made.
#
# 1.8/1.9 Hash#reject! returns Hash; ISO says nothing.
#
def
reject!
(
&
b
)
return
to_enum
:reject!
unless
block_given?
...
...
@@ -222,7 +231,21 @@ class Hash
self
end
# 1.8/1.9 Hash#reject returns Hash; ISO says nothing.
##
# call-seq:
# hsh.reject {|key, value| block} -> a_hash
# hsh.reject -> an_enumerator
#
# Returns a new hash consisting of entries for which the block returns false.
#
# If no block is given, an enumerator is returned instead.
#
# h = { "a" => 100, "b" => 200, "c" => 300 }
# h.reject {|k,v| k < "b"} #=> {"b" => 200, "c" => 300}
# h.reject {|k,v| v > 100} #=> {"a" => 100}
#
# 1.8/1.9 Hash#reject returns Hash; ISO says nothing.
#
def
reject
(
&
b
)
return
to_enum
:reject
unless
block_given?
...
...
@@ -235,7 +258,16 @@ class Hash
h
end
# 1.9 Hash#select! returns Hash; ISO says nothing.
##
# call-seq:
# hsh.select! {| key, value | block } -> hsh or nil
# hsh.select! -> an_enumerator
#
# Equivalent to <code>Hash#keep_if</code>, but returns
# <code>nil</code> if no changes were made.
#
# 1.9 Hash#select! returns Hash; ISO says nothing.
#
def
select!
(
&
b
)
return
to_enum
:select!
unless
block_given?
...
...
@@ -252,7 +284,21 @@ class Hash
self
end
# 1.9 Hash#select returns Hash; ISO says nothing.
##
# call-seq:
# hsh.select {|key, value| block} -> a_hash
# hsh.select -> an_enumerator
#
# Returns a new hash consisting of entries for which the block returns true.
#
# If no block is given, an enumerator is returned instead.
#
# h = { "a" => 100, "b" => 200, "c" => 300 }
# h.select {|k,v| k > "a"} #=> {"b" => 200, "c" => 300}
# h.select {|k,v| v < 200} #=> {"a" => 100}
#
# 1.9 Hash#select returns Hash; ISO says nothing
#
def
select
(
&
b
)
return
to_enum
:select
unless
block_given?
...
...
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