mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-26 03:01:14 +08:00
The `base.rb` file (640+ lines) contained 9 step classes, the `Context` class, and the `StepsHelpers` DSL module alongside the core concern. Each is now in its own file under `lib/service/base/`, following the existing `lib/service.rb` + `lib/service/*.rb` pattern. Also: - Update stale inline documentation in `lib/service.rb` - Use `NotImplementedError` instead of generic raise in `PolicyBase` and `ActionBase` - Move YARD DSL docs to a `@!parse` block at the top of `base.rb`
22 lines
423 B
Ruby
Vendored
22 lines
423 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
module Service
|
|
module Base
|
|
# @!visibility private
|
|
class TransactionStep < Step
|
|
include StepsHelpers
|
|
|
|
attr_reader :steps
|
|
|
|
def initialize(&block)
|
|
super("")
|
|
@steps = []
|
|
instance_exec(&block)
|
|
end
|
|
|
|
def run_step
|
|
ActiveRecord::Base.transaction { steps.each { |step| step.call(instance, context) } }
|
|
end
|
|
end
|
|
end
|
|
end
|