Module: Tins::LinesFile::LineExtension

Defined in:
lib/tins/lines_file.rb

Overview

Extension module that adds line metadata to individual lines.

This module is automatically mixed into each line when a LinesFile is created, providing access to line number and filename information directly from the line objects.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#line_numberInteger (readonly)

Returns The line number (1-based) of this line.

Returns:

  • (Integer)

    The line number (1-based) of this line



29
30
31
# File 'lib/tins/lines_file.rb', line 29

def line_number
  @line_number
end

Instance Method Details

#filenameString

Returns The filename associated with this line’s source.

Returns:

  • (String)

    The filename associated with this line’s source



32
33
34
# File 'lib/tins/lines_file.rb', line 32

def filename
  lines_file.filename.dup
end