lib/plumb/build.rb in plumb-0.0.3 vs lib/plumb/build.rb in plumb-0.0.4

- old
+ new

@@ -1,17 +1,18 @@ # frozen_string_literal: true -require 'plumb/steppable' +require 'plumb/composable' module Plumb class Build - include Steppable + include Composable - attr_reader :type + attr_reader :children def initialize(type, factory_method: :new, &block) @type = type @block = block || ->(value) { type.send(factory_method, value) } + @children = [type].freeze freeze end def call(result) = result.valid(@block.call(result.value))