Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
loki666 committed Sep 6, 2019
1 parent a1d9f6e commit 1520abd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/kotlin/net/volcanomobile/weservsdk/Weserv.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ data class Weserv internal constructor(
val crop: Crop?
)

fun weserv(lambda: WeservBuilder.() -> Unit) =
WeservBuilder().apply(lambda).build()

fun Weserv.buildUrl() =
private fun Weserv.buildUrl() =
StringBuilder(BASE_URL).apply {

append(URLEncoder.encode(url, "UTF-8"))
Expand All @@ -33,4 +30,9 @@ fun Weserv.buildUrl() =
if (crop != null)
append(crop.toQueryString())

}.toString()
}.toString()


// DSL public entry point
fun weserv(lambda: WeservBuilder.() -> Unit) =
WeservBuilder().apply(lambda).build().buildUrl()

0 comments on commit 1520abd

Please sign in to comment.