Last active
December 19, 2015 15:29
-
-
Save erokhins/5976177 to your computer and use it in GitHub Desktop.
kara.attributes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Attributes<T> { | |
var name = "No name" | |
var time = "10:00" | |
fun invoke(f: T.() -> Unit) { | |
(this as T).f() | |
} | |
} | |
class CommonAttributes: Attributes<CommonAttributes>() | |
class A { | |
class InnerAttributes : Attributes<InnerAttributes>() { | |
var href = "" | |
} | |
val attr = InnerAttributes() | |
} | |
class TABLE { | |
class InnerAttributes : Attributes<InnerAttributes>() { | |
var height = 10 | |
} | |
val attr = InnerAttributes() | |
} | |
fun TABLE.tr(content: TR.() -> Unit) {} | |
class TR { | |
val attr = CommonAttributes() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Attributes { | |
var name = "No name" | |
var time = "10:00" | |
} | |
class CommonAttributes: Attributes() { | |
fun invoke(f: CommonAttributes.() -> Unit) { | |
this.f() | |
} | |
} | |
class A { | |
class InnerAttributes : Attributes() { | |
var href = "" | |
fun invoke(f: InnerAttributes.() -> Unit) { | |
this.f() | |
} | |
} | |
val attr = InnerAttributes() | |
} | |
class TABLE { | |
class InnerAttributes : Attributes() { | |
var height = 10 | |
fun invoke(f: InnerAttributes.() -> Unit) { | |
this.f() | |
} | |
} | |
val attr = InnerAttributes() | |
} | |
fun TABLE.tr(content: TR.() -> Unit) {} | |
class TR { | |
val attr = CommonAttributes() | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment