Class: VivlioStarter::CLI::IndexCommands::IndexPlanReporter
- Inherits:
-
Object
- Object
- VivlioStarter::CLI::IndexCommands::IndexPlanReporter
- Defined in:
- lib/vivlio_starter/cli/index/index_plan_reporter.rb
Overview
索引の現況と計画を表示する
Defined Under Namespace
Classes: Plan
Constant Summary collapse
- PREVIEW_COUNT =
帯の中身を画面に出す語数。全部出すのはレビューファイルの仕事。
5
Class Method Summary collapse
-
.sample_target(estimate) ⇒ Object
「語数を直接決める場合」の例に使う語数。現在の目安の中央に寄せると 「いまと同じ値を書け」と読めてしまうので、キリのよい値へ丸める。.
Instance Method Summary collapse
-
#initialize(plan) ⇒ IndexPlanReporter
constructor
A new instance of IndexPlanReporter.
-
#render(dry_run: false) ⇒ Object
画面へ出力する。.
Constructor Details
#initialize(plan) ⇒ IndexPlanReporter
Returns a new instance of IndexPlanReporter.
54 55 56 |
# File 'lib/vivlio_starter/cli/index/index_plan_reporter.rb', line 54 def initialize(plan) @plan = plan end |
Class Method Details
.sample_target(estimate) ⇒ Object
「語数を直接決める場合」の例に使う語数。現在の目安の中央に寄せると 「いまと同じ値を書け」と読めてしまうので、キリのよい値へ丸める。
49 50 51 52 |
# File 'lib/vivlio_starter/cli/index/index_plan_reporter.rb', line 49 def self.sample_target(estimate) mid = (estimate.range.begin + estimate.range.end) / 2 [(mid / 10.0).round * 10, 10].max end |
Instance Method Details
#render(dry_run: false) ⇒ Object
画面へ出力する。
60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/vivlio_starter/cli/index/index_plan_reporter.rb', line 60 def render(dry_run: false) emit(volume_line) emit(registration_line) emit('') current_section.each { emit(it) } emit('') .each { emit(it) } emit('') candidate_section.each { emit(it) } emit('') emit((dry_run:)) end |