Class: TaintedLove::Warning

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWarning

Returns a new instance of Warning.



7
8
9
# File 'lib/tainted_love/warning.rb', line 7

def initialize
  @reported_at = Time.now.to_i
end

Instance Attribute Details

#messageObject

Returns the value of attribute message.



5
6
7
# File 'lib/tainted_love/warning.rb', line 5

def message
  @message
end

#replacerObject

Returns the value of attribute replacer.



5
6
7
# File 'lib/tainted_love/warning.rb', line 5

def replacer
  @replacer
end

#reported_atObject

Returns the value of attribute reported_at.



5
6
7
# File 'lib/tainted_love/warning.rb', line 5

def reported_at
  @reported_at
end

#stack_traceObject

Returns the value of attribute stack_trace.



5
6
7
# File 'lib/tainted_love/warning.rb', line 5

def stack_trace
  @stack_trace
end

#tagsObject

Returns the value of attribute tags.



5
6
7
# File 'lib/tainted_love/warning.rb', line 5

def tags
  @tags
end

#tainted_inputObject

Returns the value of attribute tainted_input.



5
6
7
# File 'lib/tainted_love/warning.rb', line 5

def tainted_input
  @tainted_input
end

Instance Method Details

#==(other) ⇒ Object



11
12
13
# File 'lib/tainted_love/warning.rb', line 11

def ==(other)
  stack_trace == other.stack_trace && tainted_input == other.tainted_input
end

#stack_trace_lineObject



15
16
17
# File 'lib/tainted_love/warning.rb', line 15

def stack_trace_line
  @stack_trace.lines.first
end

#to_jsonObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/tainted_love/warning.rb', line 19

def to_json
  {
    stack_trace: @stack_trace,
    replacer: @replacer,
    tainted_input: @tainted_input,
    reported_at: @reported_at,
    message: @message,
    tags: @tags,
  }.to_json
end