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
0f902279
Unverified
Commit
0f902279
authored
Nov 30, 2016
by
ksss
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change Lazy class outer
Lazy class should be under Enumerator instead of Enumerable
parent
2bb47add
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
8 deletions
+10
-8
mrbgems/default.gembox
mrbgems/default.gembox
+1
-1
mrbgems/mruby-enum-lazy/mrbgem.rake
mrbgems/mruby-enum-lazy/mrbgem.rake
+1
-1
mrbgems/mruby-enum-lazy/mrblib/lazy.rb
mrbgems/mruby-enum-lazy/mrblib/lazy.rb
+4
-2
mrbgems/mruby-enum-lazy/test/lazy.rb
mrbgems/mruby-enum-lazy/test/lazy.rb
+4
-4
No files found.
mrbgems/default.gembox
View file @
0f902279
...
...
@@ -53,7 +53,7 @@ MRuby::GemBox.new do |conf|
# Use Enumerator class (require mruby-fiber)
conf.gem :core => "mruby-enumerator"
# Use Enumera
ble
::Lazy class (require mruby-enumerator)
# Use Enumera
tor
::Lazy class (require mruby-enumerator)
conf.gem :core => "mruby-enum-lazy"
# Use toplevel object (main) methods extension
...
...
mrbgems/mruby-enum-lazy/mrbgem.rake
View file @
0f902279
MRuby
::
Gem
::
Specification
.
new
(
'mruby-enum-lazy'
)
do
|
spec
|
spec
.
license
=
'MIT'
spec
.
author
=
'mruby developers'
spec
.
summary
=
'Enumera
ble
::Lazy class'
spec
.
summary
=
'Enumera
tor
::Lazy class'
spec
.
add_dependency
(
'mruby-enumerator'
,
:core
=>
'mruby-enumerator'
)
spec
.
add_dependency
(
'mruby-enum-ext'
,
:core
=>
'mruby-enum-ext'
)
end
mrbgems/mruby-enum-lazy/mrblib/lazy.rb
View file @
0f902279
...
...
@@ -2,7 +2,7 @@ module Enumerable
# = Enumerable#lazy implementation
#
# Enumerable#lazy returns an instance of Enumera
ble
::Lazy.
# Enumerable#lazy returns an instance of Enumera
tor
::Lazy.
# You can use it just like as normal Enumerable object,
# except these methods act as 'lazy':
#
...
...
@@ -16,9 +16,11 @@ module Enumerable
# - flat_map collect_concat
# - zip
def
lazy
Lazy
.
new
(
self
)
Enumerator
::
Lazy
.
new
(
self
)
end
end
class
Enumerator
# == Acknowledgements
#
# Based on https://github.com/yhara/enumerable-lazy
...
...
mrbgems/mruby-enum-lazy/test/lazy.rb
View file @
0f902279
assert
(
"Enumera
ble
::Lazy"
)
do
assert
(
"Enumera
tor
::Lazy"
)
do
a
=
[
1
,
2
]
assert_equal
Enumera
ble
::
Lazy
,
a
.
lazy
.
class
assert_equal
Enumera
tor
::
Lazy
,
a
.
lazy
.
class
end
assert
(
"Enumera
ble
::Lazy laziness"
)
do
assert
(
"Enumera
tor
::Lazy laziness"
)
do
a
=
Object
.
new
def
a
.
each
return
to_enum
:each
unless
block_given?
...
...
@@ -40,7 +40,7 @@ assert("Enumerable::Lazy laziness") do
assert_equal
[
10
,
20
],
a
.
b
end
assert
(
"Enumera
ble
::Lazy#zip with cycle"
)
do
assert
(
"Enumera
tor
::Lazy#zip with cycle"
)
do
e1
=
[
1
,
2
,
3
].
cycle
e2
=
[
:a
,
:b
].
cycle
assert_equal
[[
1
,
:a
],[
2
,
:b
],[
3
,
:a
]],
e1
.
lazy
.
zip
(
e2
).
first
(
3
)
...
...
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