Class: Pry::Code::CodeRange Private

Inherits:
Object show all
Defined in:
lib/pry/code/code_range.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.

Represents a range of lines in a code listing.

Instance Method Summary collapse

Constructor Details

#initialize(start_line, end_line = nil) ⇒ CodeRange

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

Parameters:

  • start_line (Integer)
  • end_line (Integer?) (defaults to: nil)


11
12
13
14
15
# File 'lib/pry/code/code_range.rb', line 11

def initialize(start_line, end_line = nil)
  @start_line = start_line
  @end_line   = end_line
  force_set_end_line
end

Instance Method Details

#indices_range(lines) ⇒ Range

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.

Parameters:

  • lines (Array<LOC>)

Returns:

  • (Range)


19
20
21
# File 'lib/pry/code/code_range.rb', line 19

def indices_range(lines)
  Range.new(*indices(lines))
end