Class: Textus::Write::Mv
- Inherits:
-
Object
- Object
- Textus::Write::Mv
- Defined in:
- lib/textus/write/mv.rb
Instance Method Summary collapse
- #call(old_key, new_key, dry_run: false) ⇒ Object
-
#initialize(container:, call:) ⇒ Mv
constructor
A new instance of Mv.
Constructor Details
#initialize(container:, call:) ⇒ Mv
Returns a new instance of Mv.
4 5 6 7 8 9 10 |
# File 'lib/textus/write/mv.rb', line 4 def initialize(container:, call:) @container = container @call = call @manifest = container.manifest @events = container.events @authorizer = container. end |
Instance Method Details
#call(old_key, new_key, dry_run: false) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/textus/write/mv.rb', line 12 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 = writer.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 |