Class: Opbeat::StacktraceInterface::Frame

Inherits:
Interface
  • Object
show all
Defined in:
lib/opbeat/interfaces/stack_trace.rb

Overview

Not actually an interface, but I want to use the same style

Instance Method Summary collapse

Methods inherited from Interface

#assert_required_properties_set!, name

Constructor Details

#initialize(*arguments) ⇒ Frame

Returns a new instance of Frame.



38
39
40
41
42
43
# File 'lib/opbeat/interfaces/stack_trace.rb', line 38

def initialize(*arguments)
  self.vars= {}
  self.pre_context = []
  self.post_context = []
  super(*arguments)
end

Instance Method Details

#to_hashObject



45
46
47
48
49
50
51
52
# File 'lib/opbeat/interfaces/stack_trace.rb', line 45

def to_hash
  data = super
  data.delete('vars') unless self.vars && !self.vars.empty?
  data.delete('pre_context') unless self.pre_context && !self.pre_context.empty?
  data.delete('post_context') unless self.post_context && !self.post_context.empty?
  data.delete('context_line') unless self.context_line && !self.context_line.empty?
  data
end