Class: BuildFileOverlay

Inherits:
Object
  • Object
show all
Includes:
Callable
Defined in:
app/services/build_file_overlay.rb

Instance Method Summary collapse

Methods included from Callable

#initialize

Instance Method Details

#callObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/services/build_file_overlay.rb', line 5

def call
  @file = []
  @raw_file = File.readlines(path.path)

  @display_file = @raw_file.map.with_index(1) do |line, index|
    @file << "#{index}: #{line}"

    events = path.events.where(event_type: 'return', line_number: index)

    events.each do |event|
      item = "      <i style='color: #ccc'>>>> #{event.method} = #{event.return_value.inspect}</i>"

      next if @file.include?(item)

      @file << item
      @file << "\n"
    end
  end

  @file.join
end