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
2f9b1fdb
Unverified
Commit
2f9b1fdb
authored
Sep 16, 2019
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
Sep 16, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4255 from shuujii/enumerator-size-is-not-supported
`Enumerator#size` is not supported [ci skip]
parents
2256bb07
465fdde5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
11 deletions
+2
-11
mrbgems/mruby-enumerator/mrblib/enumerator.rb
mrbgems/mruby-enumerator/mrblib/enumerator.rb
+2
-11
No files found.
mrbgems/mruby-enumerator/mrblib/enumerator.rb
View file @
2f9b1fdb
...
@@ -89,7 +89,6 @@ class Enumerator
...
@@ -89,7 +89,6 @@ class Enumerator
include
Enumerable
include
Enumerable
##
##
# @overload initialize(size = nil, &block)
# @overload initialize(obj, method = :each, *args)
# @overload initialize(obj, method = :each, *args)
#
#
# Creates a new Enumerator object, which can be used as an
# Creates a new Enumerator object, which can be used as an
...
@@ -603,15 +602,10 @@ module Kernel
...
@@ -603,15 +602,10 @@ module Kernel
# call-seq:
# call-seq:
# obj.to_enum(method = :each, *args) -> enum
# obj.to_enum(method = :each, *args) -> enum
# obj.enum_for(method = :each, *args) -> enum
# obj.enum_for(method = :each, *args) -> enum
# obj.to_enum(method = :each, *args) {|*args| block} -> enum
# obj.enum_for(method = :each, *args){|*args| block} -> enum
#
#
# Creates a new Enumerator which will enumerate by calling +method+ on
# Creates a new Enumerator which will enumerate by calling +method+ on
# +obj+, passing +args+ if any.
# +obj+, passing +args+ if any.
#
#
# If a block is given, it will be used to calculate the size of
# the enumerator without the need to iterate it (see Enumerator#size).
#
# === Examples
# === Examples
#
#
# str = "xyz"
# str = "xyz"
...
@@ -629,17 +623,14 @@ module Kernel
...
@@ -629,17 +623,14 @@ module Kernel
# It is typical to call to_enum when defining methods for
# It is typical to call to_enum when defining methods for
# a generic Enumerable, in case no block is passed.
# a generic Enumerable, in case no block is passed.
#
#
# Here is such an example
, with parameter passing and a sizing block
:
# Here is such an example
with parameter passing
:
#
#
# module Enumerable
# module Enumerable
# # a generic method to repeat the values of any enumerable
# # a generic method to repeat the values of any enumerable
# def repeat(n)
# def repeat(n)
# raise ArgumentError, "#{n} is negative!" if n < 0
# raise ArgumentError, "#{n} is negative!" if n < 0
# unless block_given?
# unless block_given?
# return to_enum(__method__, n) do # __method__ is :repeat here
# return to_enum(__method__, n) # __method__ is :repeat here
# sz = size # Call size and multiply by n...
# sz * n if sz # but return nil if size itself is nil
# end
# end
# end
# each do |*val|
# each do |*val|
# n.times { yield *val }
# n.times { yield *val }
...
...
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