Skip to content

Instantly share code, notes, and snippets.

@Rasalexman
Last active August 27, 2019 20:41
Show Gist options
  • Save Rasalexman/45c6c0ec3d16712e8580f45bbffd1a83 to your computer and use it in GitHub Desktop.
Save Rasalexman/45c6c0ec3d16712e8580f45bbffd1a83 to your computer and use it in GitHub Desktop.
inline fun <reified T : User> user(noinline creator: UserBuilder.() -> Unit): T {
return initClass(UserBuilder(), creator).build()
}
inline fun <T, R> initClass(tag: T, init: T.() -> R): T {
tag.init()
return tag
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment