Extract interface from implementation in case of Environment and ModuleRegistry

This commit is contained in:
2020-03-10 20:34:26 +01:00
parent 3fd48b7963
commit 82e86ebc6a
4 changed files with 46 additions and 29 deletions

View File

@@ -3,18 +3,7 @@ package io.smnp.environment
import io.smnp.ext.ModuleRegistry
import io.smnp.type.module.Module
class Environment {
private val rootModule = Module("<root>")
private val loadedModules = mutableListOf<String>()
fun loadModule(path: String) {
ModuleRegistry.requestModulesForPath(path).forEach {
rootModule.addSubmodule(it)
loadedModules.add(path)
}
}
fun printModules(printContent: Boolean) {
rootModule.pretty(printContent)
}
interface Environment {
fun loadModule(path: String)
fun printModules(printContent: Boolean)
}