From 736b80835f67c9c34657074ebcfbe0752bef1c18 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Thu, 17 Oct 2019 21:58:34 +0200 Subject: Move DSL builder functions out of the companion objects (#93) --- src/main/kotlin/pl/treksoft/kvision/table/Row.kt | 28 ++++++++++-------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'src/main/kotlin/pl/treksoft/kvision/table/Row.kt') diff --git a/src/main/kotlin/pl/treksoft/kvision/table/Row.kt b/src/main/kotlin/pl/treksoft/kvision/table/Row.kt index 34ce3471..0681953f 100644 --- a/src/main/kotlin/pl/treksoft/kvision/table/Row.kt +++ b/src/main/kotlin/pl/treksoft/kvision/table/Row.kt @@ -34,25 +34,21 @@ import pl.treksoft.kvision.html.Tag open class Row(classes: Set = setOf(), init: (Row.() -> Unit)? = null) : Tag( TAG.TR, classes = classes ) { - init { @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Table.row( - classes: Set = setOf(), init: (Row.() -> Unit)? = null - ): Row { - val row = Row(classes, init) - this.add(row) - return row - } - } - +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Table.row( + classes: Set = setOf(), init: (Row.() -> Unit)? = null +): Row { + val row = Row(classes, init) + this.add(row) + return row } -- cgit