Class: Woods::Chunking::ControllerChunker Private

Inherits:
Object
  • Object
show all
Includes:
ChunkBuilder
Defined in:
lib/woods/chunking/semantic_chunker.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Chunks a controller unit by actions: summary (class + filters), then one chunk per public action method.

Constant Summary collapse

FILTER_PATTERN =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

/^\s*(before_action|after_action|around_action|skip_before_action)\b/

Instance Method Summary collapse

Constructor Details

#initialize(unit) ⇒ ControllerChunker

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ControllerChunker.

Parameters:



431
432
433
# File 'lib/woods/chunking/semantic_chunker.rb', line 431

def initialize(unit)
  @unit = unit
end

Instance Method Details

#chunkArray<Chunk>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:



436
437
438
439
# File 'lib/woods/chunking/semantic_chunker.rb', line 436

def chunk
  state = parse_lines(@unit.source_code.lines)
  build_chunks(state).reject(&:empty?)
end