Oslo is a tiny Scala library of small but hopefully useful things.
Using SBT, add the following to your build.sbt
file (see maven badge for latest version)
libraryDependencies += "net.fosdal" %% "oslo" % "<version>"
Most of Oslo is organized around package objects. In general, this means you need to import the package object and the methods are then available for use. Here is a list of the package objects and examples on using them:
TBD
TBD
TBD
TBD
TBD
def resourceContents(resourcePath: String): String = {
def fileContents(filePath: String): String = Source.fromFile(filePath).mkString
def contents(source: String): String = Try(resourceContents(source)).getOrElse(fileContents(source))
TBD
TBD
TBD
pretty: converts Duration into pretty string.
import net.fosdal.oslo.oduration._
import scala.concurrent.duration._
4000.seconds.pretty
380.minutes.pretty
35352352.seconds.pretty
res0: String = 1.1h
res1: String = 6.3h
res2: String = 409.2d
pretty(precision:Int): converts Duration into pretty string with supplied precision
import net.fosdal.oslo.oduration._
import scala.concurrent.duration._
4000.seconds.pretty()
380.minutes.pretty(0)
35352352.seconds.pretty(3)
res0: String = 1.1h
res1: String = 6h
res2: String = 409.171d