Skip to content

Instantly share code, notes, and snippets.

@Malinskiy
Created July 26, 2019 01:46
Show Gist options
  • Save Malinskiy/fb93f4c75e8eb4bf193471c05cd43e7f to your computer and use it in GitHub Desktop.
Save Malinskiy/fb93f4c75e8eb4bf193471c05cd43e7f to your computer and use it in GitHub Desktop.
Metric.kt
abstract class Metric<T, in Context>(
val provider: (Context) -> T,
val assigner: (ExecutionReport, T) -> Unit
) {
open fun get(context: Context, report: ExecutionReport) {
val value = provider(context)
assigner(report, value)
value
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment