mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Simplify module inclusion for Array, Hash and Range.
This commit is contained in:
+5
-8
@@ -4,7 +4,6 @@
|
||||
#
|
||||
# ISO 15.2.12
|
||||
class Array
|
||||
|
||||
##
|
||||
# Calls the given block for each element of +self+
|
||||
# and pass the respective element.
|
||||
@@ -193,13 +192,6 @@ class Array
|
||||
return block.call if ret.nil? && block
|
||||
ret
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# Array is enumerable
|
||||
class Array
|
||||
# ISO 15.2.12.3
|
||||
include Enumerable
|
||||
|
||||
##
|
||||
# Sort all elements and replace +self+ with these
|
||||
@@ -277,4 +269,9 @@ class Array
|
||||
self
|
||||
end
|
||||
alias entries to_a
|
||||
|
||||
##
|
||||
# Array is enumerable
|
||||
# ISO 15.2.12.3
|
||||
include Enumerable
|
||||
end
|
||||
|
||||
+6
-8
@@ -3,6 +3,12 @@
|
||||
#
|
||||
# ISO 15.2.13
|
||||
class Hash
|
||||
##
|
||||
# Hash is enumerable
|
||||
#
|
||||
# ISO 15.2.13.3
|
||||
include Enumerable
|
||||
|
||||
##
|
||||
# Equality---Two hashes are equal if they each contain the same number
|
||||
# of keys and if each key-value pair is equal to (according to
|
||||
@@ -297,11 +303,3 @@ class Hash
|
||||
h
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# Hash is enumerable
|
||||
#
|
||||
# ISO 15.2.13.3
|
||||
class Hash
|
||||
include Enumerable
|
||||
end
|
||||
|
||||
+5
-8
@@ -3,6 +3,11 @@
|
||||
#
|
||||
# ISO 15.2.14
|
||||
class Range
|
||||
##
|
||||
# Range is enumerable
|
||||
#
|
||||
# ISO 15.2.14.3
|
||||
include Enumerable
|
||||
|
||||
##
|
||||
# Calls the given block for each element of +self+
|
||||
@@ -80,11 +85,3 @@ class Range
|
||||
end
|
||||
alias entries to_a
|
||||
end
|
||||
|
||||
##
|
||||
# Range is enumerable
|
||||
#
|
||||
# ISO 15.2.14.3
|
||||
class Range
|
||||
include Enumerable
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user