Skip to content

Commit

Permalink
Minor refactors.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelhg committed Dec 10, 2020
1 parent b33be7b commit 364b2f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ but multi-page extractions and "next page" iteration aren't implemented yet.

Next: error handling, 4xx, 5xx and other responses and exceptions.

Available from JitPack.

```kotlin
import io.mikael.ksoup.KSoup

Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/io/mikael/ksoup/simple.kt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ open class SimpleExtractor<V: Any>(url: String = "") : ExtractorBase<V>() {
* ```
*/
fun <P> element(css: String, from: Element.() -> P, toProperty: KMutableProperty1<in V, P>) {
extractionCommands.add(ExtractionCommand(css, { e, v -> toProperty.set(v, e.from()) }))
extractionCommands.add(ExtractionCommand(css) { e, v -> toProperty.set(v, e.from()) })
}

/**
Expand All @@ -105,7 +105,7 @@ open class SimpleExtractor<V: Any>(url: String = "") : ExtractorBase<V>() {
* ```
*/
fun text(css: String, extract: (String, V) -> Unit) {
extractionCommands.add(ExtractionCommand(css, { e, v -> extract(e.text(), v) }))
extractionCommands.add(ExtractionCommand(css) { e, v -> extract(e.text(), v) })
}

/**
Expand All @@ -117,7 +117,7 @@ open class SimpleExtractor<V: Any>(url: String = "") : ExtractorBase<V>() {
* ```
*/
fun text(css: String, property: KMutableProperty1<V, String>) {
extractionCommands.add(ExtractionCommand(css, { e, v -> property.set(v, e.text()) }))
extractionCommands.add(ExtractionCommand(css) { e, v -> property.set(v, e.text()) })
}

/**
Expand Down

0 comments on commit 364b2f2

Please sign in to comment.