Class: VivlioStarter::CLI::DeleteCommands::DeleteCommandExecutor
- Inherits:
-
Object
- Object
- VivlioStarter::CLI::DeleteCommands::DeleteCommandExecutor
- Defined in:
- lib/vivlio_starter/cli/delete.rb
Overview
delete コマンドの制御フローを担う実行クラス
オプション解釈・対象解決・削除処理の各責務を分離し、 テスト容易性と保守性を確保している。
Instance Method Summary collapse
-
#call ⇒ DeleteSummary
削除処理を実行する.
-
#initialize(options_source, tokens) ⇒ DeleteCommandExecutor
constructor
A new instance of DeleteCommandExecutor.
Constructor Details
#initialize(options_source, tokens) ⇒ DeleteCommandExecutor
Returns a new instance of DeleteCommandExecutor.
54 55 56 57 58 |
# File 'lib/vivlio_starter/cli/delete.rb', line 54 def initialize(, tokens) @options = DeleteOptions.new() @resolver = TargetResolver.new(tokens) @deletion = ChapterDeletion.new(@options) end |
Instance Method Details
#call ⇒ DeleteSummary
削除処理を実行する
64 65 66 67 68 69 |
# File 'lib/vivlio_starter/cli/delete.rb', line 64 def call .apply_verbose! ensure_targets! targets.sum(DeleteSummary.none) { |basename| deletion.remove(basename) } end |