Class: Sarif::ThreadFlowLocation
- Inherits:
-
Object
- Object
- Sarif::ThreadFlowLocation
- Defined in:
- lib/sarif/thread_flow_location.rb
Overview
A location visited by an analysis tool while simulating or monitoring the execution of a program.
Instance Attribute Summary collapse
-
#execution_order ⇒ Object
Returns the value of attribute execution_order.
-
#execution_time_utc ⇒ Object
Returns the value of attribute execution_time_utc.
-
#importance ⇒ Object
Returns the value of attribute importance.
-
#index ⇒ Object
Returns the value of attribute index.
-
#kinds ⇒ Object
Returns the value of attribute kinds.
-
#location ⇒ Object
Returns the value of attribute location.
-
#module_name ⇒ Object
Returns the value of attribute module_name.
-
#nesting_level ⇒ Object
Returns the value of attribute nesting_level.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#stack ⇒ Object
Returns the value of attribute stack.
-
#state ⇒ Object
Returns the value of attribute state.
-
#taxa ⇒ Object
Returns the value of attribute taxa.
-
#web_request ⇒ Object
Returns the value of attribute web_request.
-
#web_response ⇒ Object
Returns the value of attribute web_response.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(index: -1,, location: nil, stack: nil, kinds: [], taxa: [], module_name: nil, state: nil, nesting_level: nil, execution_order: -1,, execution_time_utc: nil, importance: "important", web_request: nil, web_response: nil, properties: nil) ⇒ ThreadFlowLocation
constructor
A new instance of ThreadFlowLocation.
- #to_h ⇒ Object
- #to_json(pretty: false) ⇒ Object
Constructor Details
#initialize(index: -1,, location: nil, stack: nil, kinds: [], taxa: [], module_name: nil, state: nil, nesting_level: nil, execution_order: -1,, execution_time_utc: nil, importance: "important", web_request: nil, web_response: nil, properties: nil) ⇒ ThreadFlowLocation
Returns a new instance of ThreadFlowLocation.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/sarif/thread_flow_location.rb', line 8 def initialize(index: -1, location: nil, stack: nil, kinds: [], taxa: [], module_name: nil, state: nil, nesting_level: nil, execution_order: -1, execution_time_utc: nil, importance: "important", web_request: nil, web_response: nil, properties: nil) @index = index @location = location @stack = stack @kinds = kinds @taxa = taxa @module_name = module_name @state = state @nesting_level = nesting_level @execution_order = execution_order @execution_time_utc = execution_time_utc @importance = importance @web_request = web_request @web_response = web_response @properties = properties end |
Instance Attribute Details
#execution_order ⇒ Object
Returns the value of attribute execution_order.
6 7 8 |
# File 'lib/sarif/thread_flow_location.rb', line 6 def execution_order @execution_order end |
#execution_time_utc ⇒ Object
Returns the value of attribute execution_time_utc.
6 7 8 |
# File 'lib/sarif/thread_flow_location.rb', line 6 def execution_time_utc @execution_time_utc end |
#importance ⇒ Object
Returns the value of attribute importance.
6 7 8 |
# File 'lib/sarif/thread_flow_location.rb', line 6 def importance @importance end |
#index ⇒ Object
Returns the value of attribute index.
6 7 8 |
# File 'lib/sarif/thread_flow_location.rb', line 6 def index @index end |
#kinds ⇒ Object
Returns the value of attribute kinds.
6 7 8 |
# File 'lib/sarif/thread_flow_location.rb', line 6 def kinds @kinds end |
#location ⇒ Object
Returns the value of attribute location.
6 7 8 |
# File 'lib/sarif/thread_flow_location.rb', line 6 def location @location end |
#module_name ⇒ Object
Returns the value of attribute module_name.
6 7 8 |
# File 'lib/sarif/thread_flow_location.rb', line 6 def module_name @module_name end |
#nesting_level ⇒ Object
Returns the value of attribute nesting_level.
6 7 8 |
# File 'lib/sarif/thread_flow_location.rb', line 6 def nesting_level @nesting_level end |
#properties ⇒ Object
Returns the value of attribute properties.
6 7 8 |
# File 'lib/sarif/thread_flow_location.rb', line 6 def properties @properties end |
#stack ⇒ Object
Returns the value of attribute stack.
6 7 8 |
# File 'lib/sarif/thread_flow_location.rb', line 6 def stack @stack end |
#state ⇒ Object
Returns the value of attribute state.
6 7 8 |
# File 'lib/sarif/thread_flow_location.rb', line 6 def state @state end |
#taxa ⇒ Object
Returns the value of attribute taxa.
6 7 8 |
# File 'lib/sarif/thread_flow_location.rb', line 6 def taxa @taxa end |
#web_request ⇒ Object
Returns the value of attribute web_request.
6 7 8 |
# File 'lib/sarif/thread_flow_location.rb', line 6 def web_request @web_request end |
#web_response ⇒ Object
Returns the value of attribute web_response.
6 7 8 |
# File 'lib/sarif/thread_flow_location.rb', line 6 def web_response @web_response end |
Class Method Details
.from_hash(h) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/sarif/thread_flow_location.rb', line 48 def self.from_hash(h) return nil if h.nil? new( index: h["index"] || -1, location: Location.from_hash(h["location"]), stack: Stack.from_hash(h["stack"]), kinds: h["kinds"] || [], taxa: h["taxa"]&.map { |v| ReportingDescriptorReference.from_hash(v) } || [], module_name: h["module"], state: h["state"], nesting_level: h["nestingLevel"], execution_order: h["executionOrder"] || -1, execution_time_utc: h["executionTimeUtc"], importance: h["importance"] || "important", web_request: WebRequest.from_hash(h["webRequest"]), web_response: WebResponse.from_hash(h["webResponse"]), properties: h["properties"] ) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
68 69 70 71 |
# File 'lib/sarif/thread_flow_location.rb', line 68 def ==(other) return false unless other.is_a?(ThreadFlowLocation) @index == other.index && @location == other.location && @stack == other.stack && @kinds == other.kinds && @taxa == other.taxa && @module_name == other.module_name && @state == other.state && @nesting_level == other.nesting_level && @execution_order == other.execution_order && @execution_time_utc == other.execution_time_utc && @importance == other.importance && @web_request == other.web_request && @web_response == other.web_response && @properties == other.properties end |
#hash ⇒ Object
75 76 77 |
# File 'lib/sarif/thread_flow_location.rb', line 75 def hash [@index, @location, @stack, @kinds, @taxa, @module_name, @state, @nesting_level, @execution_order, @execution_time_utc, @importance, @web_request, @web_response, @properties].hash end |
#to_h ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/sarif/thread_flow_location.rb', line 25 def to_h h = {} h["index"] = @index if @index && @index != -1 h["location"] = @location&.to_h unless @location.nil? h["stack"] = @stack&.to_h unless @stack.nil? h["kinds"] = @kinds if @kinds&.any? h["taxa"] = @taxa&.map(&:to_h) if @taxa&.any? h["module"] = @module_name unless @module_name.nil? h["state"] = @state unless @state.nil? h["nestingLevel"] = @nesting_level unless @nesting_level.nil? h["executionOrder"] = @execution_order if @execution_order && @execution_order != -1 h["executionTimeUtc"] = @execution_time_utc unless @execution_time_utc.nil? h["importance"] = @importance&.to_s if @importance && @importance != "important" h["webRequest"] = @web_request&.to_h unless @web_request.nil? h["webResponse"] = @web_response&.to_h unless @web_response.nil? h["properties"] = @properties unless @properties.nil? h end |
#to_json(pretty: false) ⇒ Object
44 45 46 |
# File 'lib/sarif/thread_flow_location.rb', line 44 def to_json(pretty: false) pretty ? JSON.pretty_generate(to_h) : JSON.generate(to_h) end |