diff options
Diffstat (limited to 'ext/enumerator/enumerator.txt')
-rw-r--r-- | ext/enumerator/enumerator.txt | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/enumerator/enumerator.txt b/ext/enumerator/enumerator.txt index 9a0f93a58e..64c7d50226 100644 --- a/ext/enumerator/enumerator.txt +++ b/ext/enumerator/enumerator.txt @@ -38,6 +38,7 @@ Methods: Requiring this module also adds some methods to the Object class: + to_enum(method = :each, *args) enum_for(method = :each, *args) Returns Enumerable::Enumerator.new(self, method, *args). @@ -48,6 +49,10 @@ Requiring this module also adds some methods to the Object class: enum = str.enum_for(:each_byte) a = enum.map {|b| '%02x' % b } #=> ["78", "79", "7a"] + # protects an array from being modified + a = [1, 2, 3] + some_method(a.to_enum) + And the Enumerable module. each_slice(n) {...} |