Skip to content

Commit 0f90227

Browse files
committed
Change Lazy class outer
Lazy class should be under Enumerator instead of Enumerable
1 parent 2bb47ad commit 0f90227

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

mrbgems/default.gembox

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ MRuby::GemBox.new do |conf|
5353
# Use Enumerator class (require mruby-fiber)
5454
conf.gem :core => "mruby-enumerator"
5555

56-
# Use Enumerable::Lazy class (require mruby-enumerator)
56+
# Use Enumerator::Lazy class (require mruby-enumerator)
5757
conf.gem :core => "mruby-enum-lazy"
5858

5959
# Use toplevel object (main) methods extension
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
MRuby::Gem::Specification.new('mruby-enum-lazy') do |spec|
22
spec.license = 'MIT'
33
spec.author = 'mruby developers'
4-
spec.summary = 'Enumerable::Lazy class'
4+
spec.summary = 'Enumerator::Lazy class'
55
spec.add_dependency('mruby-enumerator', :core => 'mruby-enumerator')
66
spec.add_dependency('mruby-enum-ext', :core => 'mruby-enum-ext')
77
end

mrbgems/mruby-enum-lazy/mrblib/lazy.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Enumerable
22

33
# = Enumerable#lazy implementation
44
#
5-
# Enumerable#lazy returns an instance of Enumerable::Lazy.
5+
# Enumerable#lazy returns an instance of Enumerator::Lazy.
66
# You can use it just like as normal Enumerable object,
77
# except these methods act as 'lazy':
88
#
@@ -16,9 +16,11 @@ module Enumerable
1616
# - flat_map collect_concat
1717
# - zip
1818
def lazy
19-
Lazy.new(self)
19+
Enumerator::Lazy.new(self)
2020
end
21+
end
2122

23+
class Enumerator
2224
# == Acknowledgements
2325
#
2426
# Based on https://github.com/yhara/enumerable-lazy

mrbgems/mruby-enum-lazy/test/lazy.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
assert("Enumerable::Lazy") do
1+
assert("Enumerator::Lazy") do
22
a = [1, 2]
3-
assert_equal Enumerable::Lazy, a.lazy.class
3+
assert_equal Enumerator::Lazy, a.lazy.class
44
end
55

6-
assert("Enumerable::Lazy laziness") do
6+
assert("Enumerator::Lazy laziness") do
77
a = Object.new
88
def a.each
99
return to_enum :each unless block_given?
@@ -40,7 +40,7 @@ def a.b(b=nil)
4040
assert_equal [10,20], a.b
4141
end
4242

43-
assert("Enumerable::Lazy#zip with cycle") do
43+
assert("Enumerator::Lazy#zip with cycle") do
4444
e1 = [1, 2, 3].cycle
4545
e2 = [:a, :b].cycle
4646
assert_equal [[1,:a],[2,:b],[3,:a]], e1.lazy.zip(e2).first(3)

0 commit comments

Comments
 (0)