Skip to content
@u-gems

μ-gems

Small, composable Ruby gems with a functional heart.

μ-gems on GitHub

μ-gems

A home for small Ruby libraries. The "μ" is for micro:

each gem picks one job, names it clearly, and stops there.

Most of these came out of Ruby and Rails projects, and the ones flagged as frozen below keep the same public API for as long as Ruby keeps loading them. No upgrade treadmill.

Featured

Write use cases as small, composable objects. Each one has typed attributes, a call! method, and returns Success(...) or Failure(...). From that one shape, you can build flows, pipelines, transactions, and observers.

u-case is API-frozen. The contracts you depend on today won't move. Any next-generation rethink of the abstractions lives in solid-process instead.

Classes whose instances have readers but no setters. To change a value, call with_attribute / with_attributes and get back a new instance. You also get defaults (including callable ones), required keys, value validation (accept: / reject:), nested composition, and opt-in ActiveModel integration, all without dragging Rails in.

Also API-frozen, because u-case depends on it.

A grab bag of small, dependency-free abstractions for Ruby. Runtime type checking, monads (Kind::Maybe, Kind::Result), enums, immutable attributes, and helpers for writing business logic (Kind::Functional::Steps, Kind::Action). It started as a fast type checker and grew from there.

Other gems

  • u-observers: the observer pattern (publish/subscribe) without monkey-patching Ruby's Observable or fighting ActiveModel::Dirty.
  • u-struct: Ruby's Struct with required keys, optional fields, immutable mode, read-only mode, and a few more switches.
  • u-authorization: role and permission checks kept small and explicit.

How we think about it

A few rules shape what gets in and what stays out:

  1. One gem, one responsibility. If two ideas are wrestling for the same name, they're two gems.
  2. Backward compatibility first. A library shouldn't break the apps that already use it. Major bumps here usually mean a dropped Ruby or Rails version, not a rewritten API.
  3. Plain Ruby by default. Rails-aware code stays opt-in. If a gem works without Rails, it works without Rails.

Related

The follow-up work, where we apply what we learned from u-case and the others with fewer compatibility constraints, lives in the solid-process org.

License

Each gem ships under its own MIT license. Check the repo for details.

Popular repositories Loading

  1. u-case u-case Public

    Represent use cases in a simple and powerful way while writing modular, expressive and sequentially logical code.

    Ruby 541 31

  2. u-attributes u-attributes Public

    Create "immutable" objects with no setters, just getters.

    Ruby 92 6

  3. kind kind Public

    A development toolkit for Ruby with several small/cohesive abstractions to empower your development workflow - It's totally free of dependencies.

    Ruby 40 5

  4. u-observers u-observers Public

    Simple and powerful implementation of the observer pattern.

    Ruby 31 2

  5. u-struct u-struct Public

    Create powered Ruby structs.

    Ruby 18 1

  6. u-authorization u-authorization Public

    Simple authorization library and role managment for Ruby

    Ruby 6

Repositories

Showing 7 of 7 repositories

Top languages

Loading…

Most used topics

Loading…