Module: FlowObject::Base::ClassMethods

Included in:
FlowObject::Base
Defined in:
lib/flow_object/base.rb

Overview

Class-level interface for flow objects

Instance Method Summary collapse

Instance Method Details

#call(input:, flow: :main, &block) ⇒ Object



57
58
59
# File 'lib/flow_object/base.rb', line 57

def call(input:, flow: :main, &block)
  fo_resolve(fo_process(input, flow: flow, &block))
end

#flow(name = :main, &block) ⇒ Object



61
62
63
# File 'lib/flow_object/base.rb', line 61

def flow(name = :main, &block)
  wrap(name, delegate: true, on_exception: :halt, &block)
end

#from(input) ⇒ Object



47
48
49
50
# File 'lib/flow_object/base.rb', line 47

def from(input)
  @in = input
  self
end

#inherited(subclass) ⇒ Object



41
42
43
44
45
# File 'lib/flow_object/base.rb', line 41

def inherited(subclass)
  super
  subclass.from(self.in)
  subclass.to(out)
end

#to(output) ⇒ Object



52
53
54
55
# File 'lib/flow_object/base.rb', line 52

def to(output)
  @out = output
  self
end