element.version === currentVersion)) { versionNodes.unshift({ version: currentVersion, url: "#" }); } document.querySelector("#project-version").innerHTML = versionNodes.reduce( (acc, element) => { const status = currentVersion === element.version ? "selected disabled" : ""; return ` ${acc} `; }, `
glency · v2.0.0

glency

Deprecated in favor klubok-gleam

Package Version Hex Docs Erlang-compatible JavaScript-compatible

Tiny Gleam dependency injection. Make IO functions unit tests friendly.

gleam add glency
import glency

type Cat {
  Cat(name: String, age: Int)
}

pub fn main() {
  glency.init_di() // Firstly init DI container on application startup

  {
    // Mock implementation of `fetch_cat`
    use <- glency.with_di(fetch_cat, fn(_cat_id) { Cat("Barsik", 7) })
    fetch_cat(1) // will avoid IO, returns Barsik cat
  }
}

pub fn fetch_cat(cat_id: Int) {
  use <- glency.di(fetch_cat, #(cat_id)) // Make IO function DI friendly
  // Here production IO implementation of function
}

Further documentation can be found at https://hexdocs.pm/glency.

Development

gleam run   # Run the project
gleam test  # Run the tests
gleam shell # Run an Erlang shell
Search Document