class ActionPatternFactory < SimpleDelegator
  attr_reader :obj
  def process
    @obj = __getobj__
    @obj.process if obj.respond_to?(:process)
    run_action!
  end

  def run_action!
    if (cn = connected_node).present? && (kind = obj.kind).present?
      # then the connected_node 'uses' this kind of item
      cn.uses! kind
    end
  end

  private

  def connected_node
    Node.find(connected_node_id) if connected_node_id.present?
  end
end
