Class: Textus::Application::Writes::Mv

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/application/writes/mv.rb

Defined Under Namespace

Classes: MovePlan

Instance Method Summary collapse

Constructor Details

#initialize(ctx:, bus:) ⇒ Mv

Returns a new instance of Mv.



12
13
14
15
# File 'lib/textus/application/writes/mv.rb', line 12

def initialize(ctx:, bus:)
  @ctx = ctx
  @bus = bus
end

Instance Method Details

#call(old_key, new_key, dry_run: false) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/textus/application/writes/mv.rb', line 17

def call(old_key, new_key, dry_run: false)
  plan, pre_env = prepare_plan(old_key, new_key)
  return dry_run_result(plan) if dry_run

  plan = ensure_uid!(plan, pre_env: pre_env)
  etag_after = perform_move!(plan)
  new_envelope = record_move(plan, etag_after: etag_after)
  success_result(plan, new_envelope: new_envelope)
end