2024-09-09 23:14:39 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Migrations::Converters::Base
|
|
|
|
class Step
|
|
|
|
IntermediateDB = ::Migrations::Database::IntermediateDB
|
|
|
|
|
|
|
|
attr_accessor :settings
|
2024-11-20 06:54:37 +08:00
|
|
|
attr_reader :tracker
|
2024-09-09 23:14:39 +08:00
|
|
|
|
2024-11-20 06:54:37 +08:00
|
|
|
# inside of Step it might make more sense to access it as `step` instead of `tracker`
|
|
|
|
alias step tracker
|
|
|
|
|
|
|
|
def initialize(tracker, args = {})
|
|
|
|
@tracker = tracker
|
|
|
|
|
|
|
|
args.each do |arg, value|
|
|
|
|
setter = "#{arg}=".to_sym
|
|
|
|
public_send(setter, value) if respond_to?(setter, true)
|
|
|
|
end
|
2024-09-09 23:14:39 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
|
|
|
# do nothing
|
|
|
|
end
|
|
|
|
|
|
|
|
class << self
|
|
|
|
def title(
|
|
|
|
value = (
|
|
|
|
getter = true
|
|
|
|
nil
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@title = value unless getter
|
|
|
|
@title.presence ||
|
|
|
|
I18n.t(
|
|
|
|
"converter.default_step_title",
|
|
|
|
type: name&.demodulize&.underscore&.humanize(capitalize: false),
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|