Specification invoke made inline

This commit is contained in:
Alexander Nozik 2020-03-26 21:11:23 +03:00
parent 5c3d51de58
commit 66cee2d42b

View File

@ -17,8 +17,6 @@ interface Specification<T : Configurable> {
return wrap(config).apply(action)
}
operator fun invoke(action: T.() -> Unit) = empty().apply(action)
fun empty() = wrap()
/**
@ -37,6 +35,8 @@ interface Specification<T : Configurable> {
fun wrap(default: Meta): T = wrap(Config()) { default[it] }
}
inline operator fun <T : Configurable> Specification<T>.invoke(action: T.() -> Unit) = empty().apply(action)
/**
* Apply specified configuration to configurable
*/