bin/examples.rb in flows-0.1.0 vs bin/examples.rb in flows-0.2.0

- old
+ new

@@ -17,10 +17,20 @@ def sum(a:, b:, **) ok(sum: a + b) end end +class FlowsRailwaySummator + include Flows::Railway + + step :sum + + def sum(a:, b:) + ok(sum: a + b) + end +end + class POROSummator def self.call(a:, b:) a + b end end @@ -44,11 +54,11 @@ opts[:sum] = a + b end end # -# Task: 10 steps which returs simple value +# Task: 10 steps which returns simple value # class FlowsTenSteps include Flows::Operation @@ -74,9 +84,35 @@ def s6(**); ok(s6: true); end def s7(**); ok(s7: true); end def s8(**); ok(s8: true); end def s9(**); ok(s9: true); end def s10(**); ok(data: :ok); end +end + +class FlowsRailwayTenSteps + include Flows::Railway + + step :s1 + step :s2 + step :s3 + step :s4 + step :s5 + step :s6 + step :s7 + step :s8 + step :s9 + step :s10 + + def s1(**); ok(s1: true); end + def s2(s1:); ok(s2: s1); end + def s3(s2:); ok(s3: s2); end + def s4(s3:); ok(s4: s3); end + def s5(s4:); ok(s5: s4); end + def s6(s5:); ok(s6: s5); end + def s7(s6:); ok(s7: s6); end + def s8(s7:); ok(s8: s7); end + def s9(s8:); ok(s9: s8); end + def s10(s9:); ok(data: :ok); end end class POROTenSteps class << self def call()