Class: Oopsy

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exception, file_path) ⇒ Oopsy

Returns a new instance of Oopsy.



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rspec_html_formatter.rb', line 14

def initialize(exception, file_path)
  @exception = exception
  @file_path = file_path
  unless @exception.nil?
    @klass = @exception.class
    @message = @exception.message.encode('utf-8')
    @backtrace = @exception.backtrace
    @backtrace_message = @backtrace.select { |r| r.match(@file_path) }.join('').encode('utf-8')
    @highlighted_source = process_source
    @explanation = process_message
  end
end

Instance Attribute Details

#backtraceObject (readonly)

Returns the value of attribute backtrace.



12
13
14
# File 'lib/rspec_html_formatter.rb', line 12

def backtrace
  @backtrace
end

#backtrace_messageObject (readonly)

Returns the value of attribute backtrace_message.



12
13
14
# File 'lib/rspec_html_formatter.rb', line 12

def backtrace_message
  @backtrace_message
end

#explanationObject (readonly)

Returns the value of attribute explanation.



12
13
14
# File 'lib/rspec_html_formatter.rb', line 12

def explanation
  @explanation
end

#highlighted_sourceObject (readonly)

Returns the value of attribute highlighted_source.



12
13
14
# File 'lib/rspec_html_formatter.rb', line 12

def highlighted_source
  @highlighted_source
end

#klassObject (readonly)

Returns the value of attribute klass.



12
13
14
# File 'lib/rspec_html_formatter.rb', line 12

def klass
  @klass
end

#messageObject (readonly)

Returns the value of attribute message.



12
13
14
# File 'lib/rspec_html_formatter.rb', line 12

def message
  @message
end