Module: Jrf

Defined in:
lib/jrf.rb,
lib/jrf/cli.rb,
lib/jrf/stage.rb,
lib/jrf/runner.rb,
lib/jrf/control.rb,
lib/jrf/version.rb,
lib/jrf/pipeline.rb,
lib/jrf/reducers.rb,
lib/jrf/row_context.rb,
lib/jrf/pipeline_parser.rb

Defined Under Namespace

Modules: Control, Reducers Classes: CLI, Pipeline, PipelineParser, RowContext, Runner, Stage

Constant Summary collapse

VERSION =
"0.1.5"

Class Method Summary collapse

Class Method Details

.new(*blocks) ⇒ Pipeline

Create a pipeline from one or more stage blocks.

Each block is evaluated in a context where _ is the current value. All jrf built-in functions (select, sum, map, group_by, etc.) are available inside blocks. See github.com/kazuho/jrf#readme for the full list.

Examples:

j = Jrf.new(proc { select(_["x"] > 10) }, proc { sum(_["x"]) })
j.call([{"x" => 20}, {"x" => 30}])  # => [50]

Parameters:

  • blocks (Array<Proc>)

    one or more stage procs

Returns:



19
20
21
# File 'lib/jrf.rb', line 19

def self.new(*blocks)
  Pipeline.new(*blocks)
end