Class: ReplCode::CodeRange Private

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet-repl/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)


10
11
12
13
14
# File 'lib/puppet-repl/code/code_range.rb', line 10

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)


18
19
20
# File 'lib/puppet-repl/code/code_range.rb', line 18

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