lib/trailblazer/operation/pipetree.rb in trailblazer-operation-0.0.3 vs lib/trailblazer/operation/pipetree.rb in trailblazer-operation-0.0.4

- old
+ new

@@ -21,13 +21,16 @@ # Top-level, this method is called when you do Create.() and where # all the fun starts, ends, and hopefully starts again. def call(options) pipe = self["pipetree"] # TODO: injectable? WTF? how cool is that? - last, operation = pipe.(self, options) # operation == self, usually. + last, operation = pipe.(self, options) - Result.new(last == ::Pipetree::Flow::Right, operation) + # The reason the Result wraps the Skill object (`options`), not the operation + # itself is because the op should be irrelevant, plus when stopping the pipe + # before op instantiation, this would be confusing (and wrong!). + Result.new(last == ::Pipetree::Flow::Right, options) end # This method would be redundant if Ruby had a Class::finalize! method the way # Dry.RB provides it. It has to be executed with every subclassing. def initialize_pipetree! @@ -54,10 +57,10 @@ self.|(cfg, inheriting: true) # FIXME: not sure if this is the final API. end def |(cfg, user_options={}) # sorry for the magic here, but still playing with the DSL. - if cfg.is_a?(Stepable) # e.g. Contract::Validate + if cfg.is_a?(Macro) # e.g. Contract::Validate import = Import.new(self, user_options) return cfg.import!(self, import) && heritage.record(:|, cfg, user_options) end