Class: Sarif::StackFrame
- Inherits:
-
Object
- Object
- Sarif::StackFrame
- Defined in:
- lib/sarif/stack_frame.rb
Overview
A function call within a stack trace.
Instance Attribute Summary collapse
-
#location ⇒ Object
Returns the value of attribute location.
-
#module_name ⇒ Object
Returns the value of attribute module_name.
-
#parameters ⇒ Object
Returns the value of attribute parameters.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#thread_id ⇒ Object
Returns the value of attribute thread_id.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(location: nil, module_name: nil, thread_id: nil, parameters: [], properties: nil) ⇒ StackFrame
constructor
A new instance of StackFrame.
- #to_h ⇒ Object
- #to_json(pretty: false) ⇒ Object
Constructor Details
#initialize(location: nil, module_name: nil, thread_id: nil, parameters: [], properties: nil) ⇒ StackFrame
8 9 10 11 12 13 14 |
# File 'lib/sarif/stack_frame.rb', line 8 def initialize(location: nil, module_name: nil, thread_id: nil, parameters: [], properties: nil) @location = location @module_name = module_name @thread_id = thread_id @parameters = parameters @properties = properties end |
Instance Attribute Details
#location ⇒ Object
Returns the value of attribute location.
6 7 8 |
# File 'lib/sarif/stack_frame.rb', line 6 def location @location end |
#module_name ⇒ Object
Returns the value of attribute module_name.
6 7 8 |
# File 'lib/sarif/stack_frame.rb', line 6 def module_name @module_name end |
#parameters ⇒ Object
Returns the value of attribute parameters.
6 7 8 |
# File 'lib/sarif/stack_frame.rb', line 6 def parameters @parameters end |
#properties ⇒ Object
Returns the value of attribute properties.
6 7 8 |
# File 'lib/sarif/stack_frame.rb', line 6 def properties @properties end |
#thread_id ⇒ Object
Returns the value of attribute thread_id.
6 7 8 |
# File 'lib/sarif/stack_frame.rb', line 6 def thread_id @thread_id end |
Class Method Details
.from_hash(h) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/sarif/stack_frame.rb', line 30 def self.from_hash(h) return nil if h.nil? new( location: Location.from_hash(h["location"]), module_name: h["module"], thread_id: h["threadId"], parameters: h["parameters"] || [], properties: h["properties"] ) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
41 42 43 44 |
# File 'lib/sarif/stack_frame.rb', line 41 def ==(other) return false unless other.is_a?(StackFrame) @location == other.location && @module_name == other.module_name && @thread_id == other.thread_id && @parameters == other.parameters && @properties == other.properties end |
#hash ⇒ Object
48 49 50 |
# File 'lib/sarif/stack_frame.rb', line 48 def hash [@location, @module_name, @thread_id, @parameters, @properties].hash end |
#to_h ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/sarif/stack_frame.rb', line 16 def to_h h = {} h["location"] = @location&.to_h unless @location.nil? h["module"] = @module_name unless @module_name.nil? h["threadId"] = @thread_id unless @thread_id.nil? h["parameters"] = @parameters if @parameters&.any? h["properties"] = @properties unless @properties.nil? h end |
#to_json(pretty: false) ⇒ Object
26 27 28 |
# File 'lib/sarif/stack_frame.rb', line 26 def to_json(pretty: false) pretty ? JSON.pretty_generate(to_h) : JSON.generate(to_h) end |