Skip to content

Instantly share code, notes, and snippets.

@danveloper
Created February 20, 2014 18:42
Show Gist options
  • Save danveloper/9120417 to your computer and use it in GitHub Desktop.
Save danveloper/9120417 to your computer and use it in GitHub Desktop.
RxRatpack
@Grab("io.ratpack:ratpack-rx:0.9.1")
import ratpack.launch.*
import ratpack.rx.internal.*
def cfg = LaunchConfigBuilder.baseDir(new File("/tmp")).build()
def rx = new DefaultRxBackground(cfg.background)
def list = ['fee', 'fie', 'fo', 'fum']
def str = ""
rx.observeEach { list }
.map { it.toLowerCase() }
.subscribe({
println "event"
str += it
}, { Throwable err ->
throw err
}, {
println "done :-) $str"
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment