Project

stroma

0.0
No release in over 3 years
A structured approach to composing DSL modules for Ruby libraries with optional extension hooks
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 2.5
>= 13.2
>= 3.13

Runtime

 Project Readme

Stroma

A foundation for building modular, extensible DSLs in Ruby.

Gem version Release Date Downloads Ruby version

๐Ÿ’ก Why Stroma?

Building modular DSLs shouldn't require reinventing the wheel. Stroma provides a structured approach for library authors to compose DSL modules with:

  • ๐Ÿ”Œ Module Registration - Register DSL modules at boot time, compose them into a unified interface
  • ๐Ÿงฑ Structured Composition - Include all registered modules automatically via single DSL entry point
  • ๐Ÿ›๏ธ Inheritance Safe - Per-class state isolation with automatic deep copying
  • ๐Ÿช Extension Hooks - Optional before/after hooks for user customization
  • โš™๏ธ Extension Settings - Three-level hierarchical storage for extension configuration
  • ๐Ÿ”’ Thread Safe - Immutable registry after finalization, safe concurrent reads

๐Ÿงฌ Concept

Stroma is a foundation for library authors building DSL-driven frameworks (service objects, form objects, decorators, etc.).

Core lifecycle:

  1. Register - Define DSL modules at boot time via Stroma::Registry
  2. Compose - Classes include Stroma::DSL to gain all registered modules automatically
  3. Extend (optional) - Users can add cross-cutting logic via before/after hooks

๐Ÿš€ Quick Start

Installation

gem "stroma"

Define your library's DSL

module MyLib
  module DSL
    # Register DSL modules at load time
    Stroma::Registry.register(:inputs, MyLib::Inputs::DSL)
    Stroma::Registry.register(:actions, MyLib::Actions::DSL)
    Stroma::Registry.finalize!

    def self.included(base)
      base.include(Stroma::DSL)
    end
  end
end

Create base class

module MyLib
  class Base
    include MyLib::DSL
  end
end

Usage

class UserService < MyLib::Base
  input :email, type: String

  make :create_user

  private

  def create_user
    # implementation
  end
end

๐Ÿค Contributing

We welcome contributions! Check out our Contributing Guide to get started.

Ways to contribute:

  • ๐Ÿ› Report bugs and issues
  • ๐Ÿ’ก Suggest new features
  • ๐Ÿ“ Improve documentation
  • ๐Ÿงช Add test cases
  • ๐Ÿ”ง Submit pull requests

๐Ÿ™ Acknowledgments

Special thanks to all our contributors!

๐Ÿ“„ License

Stroma is available as open source under the terms of the MIT License.