Class: Vivlio::Starter::CLI::PreProcessCommands::CrossReferenceProcessor::LabelCollectorContext

Inherits:
Object
  • Object
show all
Defined in:
lib/vivlio/starter/cli/pre_process/cross_reference_processor.rb

Overview

ラベル収集用コンテキスト

Instance Method Summary collapse

Constructor Details

#initialize(source_file, chapter_number) ⇒ LabelCollectorContext

Returns a new instance of LabelCollectorContext.



143
144
145
146
147
148
149
150
151
# File 'lib/vivlio/starter/cli/pre_process/cross_reference_processor.rb', line 143

def initialize(source_file, chapter_number)
  @source_file = source_file
  @chapter_number = chapter_number
  @labels = []
  @errors = []
  @counters = Hash.new(0)
  @in_code = false
  @fence_marker = nil
end

Instance Method Details

#collect(content) ⇒ Object



153
154
155
156
157
# File 'lib/vivlio/starter/cli/pre_process/cross_reference_processor.rb', line 153

def collect(content)
  lines = content.lines
  lines.each_with_index { |line, idx| process_line(line, idx, lines) }
  { labels: @labels, errors: @errors }
end