Class: Woods::Chunking::MethodChunker 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.

Generic method-aware chunker for class-like unit types.

Splits into:

  • ‘:summary` — class/module declaration, includes, constants, attr_* DSL, class-level method calls, and any class-level code before the first public method.

  • ‘:method_<name>` — one chunk per public instance method.

  • ‘:private_methods` — all private/protected methods bundled together (they’re usually implementation helpers and rarely queried individually).

Used for services, jobs, mailers, concerns, policies, serializers, decorators, presenters, interactors, form objects, components, GraphQL resolvers, helpers, validators, and other class-like units.

Instance Method Summary collapse

Constructor Details

#initialize(unit) ⇒ MethodChunker

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 MethodChunker.

Parameters:



525
526
527
# File 'lib/woods/chunking/semantic_chunker.rb', line 525

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:



530
531
532
533
# File 'lib/woods/chunking/semantic_chunker.rb', line 530

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