Class: Cease::Eviction::Scope

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/cease/eviction/scope.rb

Instance Method Summary collapse

Constructor Details

#initialize(chunk:, comments:, statement:) ⇒ Scope

Returns a new instance of Scope.



13
14
15
16
17
# File 'lib/cease/eviction/scope.rb', line 13

def initialize(chunk:, comments:, statement:)
  @chunk = chunk
  @comments = comments
  @statement = statement
end

Instance Method Details

#formatArray<String>

Returns:

  • (Array<String>)


20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/cease/eviction/scope.rb', line 20

def format
  length = formatted_lines.length

  case length
  when (0..25) then formatted_lines
  else
    [
      formatted_lines[0..10],
      formatted_lines[11] << "\n",
      Rainbow("...#{line_count - 12} line(s) truncated.").yellow
    ].flatten
  end
end