Class: TestOne

Inherits:
Object
  • Object
show all
Includes:
Callable
Defined in:
app/services/test_one.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
26
27
28
29
30
31
32
33
# File 'app/services/test_one.rb', line 5

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

  return @raw_file

  path.events.where(event_type: 'return').each do |event|
    href = "<a href='#'>#{event.method}</a>"

    matches = @raw_file.gsub!(/#{event.method}/, href)
  end

  return @raw_file
    
    
    
    @display_file = @raw_file.map.with_index(1) do |line, index|
    @file << line

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

    events.map do |event|
      @file << ">>> #{event.return_value.inspect} (#{event.method})"
      @file << "\n"
    end
  end

  @file
end