All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jove.notebook.components.Config.scala Maven / Gradle / Ivy

The newest version!
package jove.notebook.components

import argonaut.JsonObject

class Config {
  // On disk in official ipython
  private val _configLock = new AnyRef
  private var _config = Map.empty[String, JsonObject]

  def configItem(id: String): Option[JsonObject] =
    _configLock.synchronized {
      _config.get(id)
    }

  def setConfigItem(id: String, obj: JsonObject): Unit =
    _configLock.synchronized {
      _config += id -> obj
    }

  def withConfigItem(id: String)(f: Option[JsonObject] => JsonObject): JsonObject =
    _configLock.synchronized {
      val o = f(_config.get(id))
      _config += id -> o
      o
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy