Class: Gotenberg::Backtrace

Inherits:
Object
  • Object
show all
Defined in:
lib/gotenberg/backtrace.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(files) ⇒ Backtrace

Returns a new instance of Backtrace.



7
8
9
# File 'lib/gotenberg/backtrace.rb', line 7

def initialize files
  @files = files
end

Instance Attribute Details

#filesObject

Returns the value of attribute files.



5
6
7
# File 'lib/gotenberg/backtrace.rb', line 5

def files
  @files
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/gotenberg/backtrace.rb', line 11

def call
  return unless index_available?

  FileUtils.mkdir_p(backtrace_location)

  files.each do |file|
    File.open(File.join(backtrace_location, file.original_filename), 'wb') do |f|
      f << file.io.read
    end

    file.io.rewind
  end

  ::Launchy.open(File.join(backtrace_location, 'index.html'))
end