mirror of
https://github.com/ethauvin/kobalt-doc.git
synced 2025-04-24 19:47:11 -07:00
Builder.
This commit is contained in:
parent
6c17270b8d
commit
c11be25ff8
1 changed files with 1 additions and 4 deletions
|
@ -302,10 +302,7 @@ class Info(val publish: Boolean)
|
||||||
</p>
|
</p>
|
||||||
<pre>
|
<pre>
|
||||||
@Directive
|
@Directive
|
||||||
public fun myConfig(init: Info.() -> Unit) = Info().apply {
|
public fun myConfig(init: Info.() -> Unit) = Info().apply { init() }</pre>
|
||||||
init()
|
|
||||||
this
|
|
||||||
}</pre>
|
|
||||||
<p>
|
<p>
|
||||||
The <code>@Directive</code> annotation is not enforced but you should always use it in order to help future tools (e.g. an IDEA plug-in) identify Kobalt directives so they can be treated differently from regular Kotlin functions. The code above defines a <code>myConfig</code> function that accepts a closure as an argument. It creates an <code>Info</code>
|
The <code>@Directive</code> annotation is not enforced but you should always use it in order to help future tools (e.g. an IDEA plug-in) identify Kobalt directives so they can be treated differently from regular Kotlin functions. The code above defines a <code>myConfig</code> function that accepts a closure as an argument. It creates an <code>Info</code>
|
||||||
object, calls the <code>init()</code> function on it (which runs all the code inside that closure) and then return that <code>Info</code> object.
|
object, calls the <code>init()</code> function on it (which runs all the code inside that closure) and then return that <code>Info</code> object.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue