Class: VivlioStarter::CLI::DeleteCommands::DeleteOptions
- Inherits:
-
Object
- Object
- VivlioStarter::CLI::DeleteCommands::DeleteOptions
- Defined in:
- lib/vivlio_starter/cli/delete.rb
Overview
CLI オプションを正規化し、各種フラグへのアクセスを提供する
異なる形式のオプション入力(Hash / Samovar コマンド)を 統一的なインターフェースで扱えるようにする
Instance Method Summary collapse
-
#apply_verbose! ⇒ Object
verbose オプションが有効な場合、環境変数を設定してログを詳細化する.
-
#force? ⇒ Boolean
Force モードが有効か(--yes も同義).
-
#initialize(source) ⇒ DeleteOptions
constructor
A new instance of DeleteOptions.
-
#verbose? ⇒ Boolean
Verbose モードが有効か.
Constructor Details
#initialize(source) ⇒ DeleteOptions
Returns a new instance of DeleteOptions.
98 99 100 |
# File 'lib/vivlio_starter/cli/delete.rb', line 98 def initialize(source) @option_values = extract_option_values(source) end |
Instance Method Details
#apply_verbose! ⇒ Object
verbose オプションが有効な場合、環境変数を設定してログを詳細化する
103 104 105 |
# File 'lib/vivlio_starter/cli/delete.rb', line 103 def apply_verbose! ENV['VERBOSE'] = '1' if verbose? end |
#force? ⇒ Boolean
Returns force モードが有効か(--yes も同義).
108 109 110 |
# File 'lib/vivlio_starter/cli/delete.rb', line 108 def force? !!(option_values[:force] || option_values[:yes]) end |
#verbose? ⇒ Boolean
Returns verbose モードが有効か.
113 114 115 |
# File 'lib/vivlio_starter/cli/delete.rb', line 113 def verbose? !!option_values[:verbose] end |