ScriptEditor class has methods getFoldingStructureProvider() and createFoldingActionGroup(). In general, folding structure provider should just implement IFoldingStructureProvider. But if you are using a DLTK AST, you can fetch folding "for free", just by extending AbstractASTFoldingStructureProvider.
Folding actions group can be created like following(FoldingActionGroup is a default DLTK implementation):
protected FoldingActionGroup createFoldingActionGroup() { return new FoldingActionGroup(this, getViewer(), RubyUI.getDefault() .getPreferenceStore()); }