Sha256: 8af602c8f60b09371784ea0c347c76032eb4a0c53c8f80ea762cb257e6140dbe
Contents?: true
Size: 671 Bytes
Versions: 5
Compression:
Stored size: 671 Bytes
Contents
module Flows # Representation of FSM node. class Node attr_reader :name, :meta def initialize(name:, body:, router:, meta: {}, preprocessor: nil, postprocessor: nil) @name = name @body = body @router = router @meta = meta.freeze @preprocessor = preprocessor @postprocessor = postprocessor end def call(input, context:) input = @preprocessor.call(input, context, @meta) if @preprocessor output = @body.call(input) output = @postprocessor.call(output, context, @meta) if @postprocessor route = @router.call(output, context: context, meta: @meta) [output, route] end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
flows-0.3.0 | lib/flows/node.rb |
flows-0.2.0 | lib/flows/node.rb |
flows-0.1.0 | lib/flows/node.rb |
flows-0.0.2 | lib/flows/node.rb |
flows-0.0.1 | lib/flows/node.rb |