Class: Textus::Application::Writes::Mv
- Inherits:
-
Object
- Object
- Textus::Application::Writes::Mv
- Defined in:
- lib/textus/application/writes/mv.rb
Instance Method Summary collapse
- #call(old_key, new_key, dry_run: false) ⇒ Object
-
#initialize(ctx:, manifest:, envelope_io:, bus:, authorizer:, hook_context:) ⇒ Mv
constructor
A new instance of Mv.
Constructor Details
#initialize(ctx:, manifest:, envelope_io:, bus:, authorizer:, hook_context:) ⇒ Mv
Returns a new instance of Mv.
5 6 7 8 9 10 11 12 |
# File 'lib/textus/application/writes/mv.rb', line 5 def initialize(ctx:, manifest:, envelope_io:, bus:, authorizer:, hook_context:) @ctx = ctx @manifest = manifest @envelope_io = envelope_io @bus = bus @authorizer = @hook_context = hook_context end |
Instance Method Details
#call(old_key, new_key, dry_run: false) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/textus/application/writes/mv.rb', line 14 def call(old_key, new_key, dry_run: false) old_res, new_res = prepare(old_key, new_key) return dry_run_result(old_key, new_key, old_res, new_res) if dry_run ensure_uid!(old_key, old_res.entry) envelope = @envelope_io.move( from_key: old_key, to_key: new_key, new_mentry: new_res.entry ) publish_renamed(old_key, new_key, envelope) success_result(old_key, new_key, old_res, new_res, envelope) end |