piperator:枚举器的可组合管道

时间:2021-05-08 16:52:52
【文件属性】:
文件名称:piperator:枚举器的可组合管道
文件大小:15KB
文件格式:ZIP
更新时间:2021-05-08 16:52:52
Ruby 吹笛者 用于流传输大集合的管道。 管道启用了带有惰性枚举的流管道的组合。 该库在很大程度上受到和启发。 目录 安装 Piperator以Ruby宝石的形式分发,可以与以下产品一起安装 $ gem install piperator 用法 首先需要宝石 require 'piperator' 流水线 作为开胃菜,这里有一条管道,将所有输入值加三倍,然后对这些值求和。 Piperator . pipe ( -> ( values ) { values . lazy . map { | i | i * 3 } } ) . pipe ( -> ( values ) { values . sum } ) . call ( [ 1 , 2 , 3 ] ) # => 18 使用DSL代替方法链接也可以实现相同的目的: Piperator . build do pipe ( ->
【文件预览】:
piperator-master
----bin()
--------console(344B)
--------setup(131B)
----Rakefile(114B)
----.github()
--------workflows()
----Gemfile(94B)
----piperator.gemspec(996B)
----.rspec(31B)
----spec()
--------piperator_spec.rb(2KB)
--------spec_helper.rb(263B)
--------piperator()
----.gitignore(127B)
----CHANGELOG.md(300B)
----lib()
--------piperator.rb(2KB)
--------piperator()
----README.md(6KB)
----LICENSE.txt(1KB)

网友评论