Module: Treaty::Action::Context::DSL

Included in:
Base
Defined in:
lib/treaty/action/context/dsl.rb

Overview

DSL module that wires up callable and workspace functionality.

Purpose

Acts as a composition root that includes both Callable (class methods) and Workspace (instance methods) when included in a treaty class. This enables the call! API pattern.

Usage

Included in:

  • Treaty::Action::Base (as part of core DSL)

What it provides

When included, adds:

  • Class method: call! (from Callable)
  • Instance methods: _call!, call! (from Workspace)

Architecture

The call chain works as follows:

MyTreaty.call!(version:, params:, ...)
  │
  └─► Callable.call! (class method)
        │
        ├─► Creates treaty instance
        │
        └─► Workspace._call! (instance method)
              │
              └─► Workspace.call! (stores @collection_of_versions)
                    │
                    └─► super → Versions::Workspace.call!

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Hook called when module is included

Extends the including class with Callable (class methods) and includes Workspace (instance methods).

Parameters:

  • base (Class)

    The class including this module



49
50
51
52
# File 'lib/treaty/action/context/dsl.rb', line 49

def self.included(base)
  base.extend(Callable)
  base.include(Workspace)
end