Class: SemgrepWebApp::ProtosScaV1CodeLocation
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SemgrepWebApp::ProtosScaV1CodeLocation
- Defined in:
- lib/semgrep_web_app/models/protos_sca_v1_code_location.rb
Overview
Specific location in a file.
Instance Attribute Summary collapse
-
#committed_at ⇒ DateTime
Timestamp when code file was last modified, if available.
-
#end_col ⇒ String
Ending column number (1 indexed).
-
#end_line ⇒ String
Ending line number (1 indexed).
-
#path ⇒ String
Path to a file.
-
#start_col ⇒ String
Starting column number (1 indexed).
-
#start_line ⇒ String
Starting line number (1 indexed).
-
#url ⇒ String
URL to code location if available, otherwise empty.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(committed_at: SKIP, end_col: SKIP, end_line: SKIP, path: SKIP, start_col: SKIP, start_line: SKIP, url: SKIP, additional_properties: nil) ⇒ ProtosScaV1CodeLocation
constructor
A new instance of ProtosScaV1CodeLocation.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_committed_at ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(committed_at: SKIP, end_col: SKIP, end_line: SKIP, path: SKIP, start_col: SKIP, start_line: SKIP, url: SKIP, additional_properties: nil) ⇒ ProtosScaV1CodeLocation
Returns a new instance of ProtosScaV1CodeLocation.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_code_location.rb', line 72 def initialize(committed_at: SKIP, end_col: SKIP, end_line: SKIP, path: SKIP, start_col: SKIP, start_line: SKIP, url: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @committed_at = committed_at unless committed_at == SKIP @end_col = end_col unless end_col == SKIP @end_line = end_line unless end_line == SKIP @path = path unless path == SKIP @start_col = start_col unless start_col == SKIP @start_line = start_line unless start_line == SKIP @url = url unless url == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#committed_at ⇒ DateTime
Timestamp when code file was last modified, if available.
15 16 17 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_code_location.rb', line 15 def committed_at @committed_at end |
#end_col ⇒ String
Ending column number (1 indexed).
19 20 21 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_code_location.rb', line 19 def end_col @end_col end |
#end_line ⇒ String
Ending line number (1 indexed).
23 24 25 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_code_location.rb', line 23 def end_line @end_line end |
#path ⇒ String
Path to a file.
27 28 29 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_code_location.rb', line 27 def path @path end |
#start_col ⇒ String
Starting column number (1 indexed).
31 32 33 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_code_location.rb', line 31 def start_col @start_col end |
#start_line ⇒ String
Starting line number (1 indexed).
35 36 37 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_code_location.rb', line 35 def start_line @start_line end |
#url ⇒ String
URL to code location if available, otherwise empty.
39 40 41 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_code_location.rb', line 39 def url @url end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_code_location.rb', line 89 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. committed_at = if hash.key?('committedAt') (DateTimeHelper.from_rfc3339(hash['committedAt']) if hash['committedAt']) else SKIP end end_col = hash.key?('endCol') ? hash['endCol'] : SKIP end_line = hash.key?('endLine') ? hash['endLine'] : SKIP path = hash.key?('path') ? hash['path'] : SKIP start_col = hash.key?('startCol') ? hash['startCol'] : SKIP start_line = hash.key?('startLine') ? hash['startLine'] : SKIP url = hash.key?('url') ? hash['url'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. ProtosScaV1CodeLocation.new(committed_at: committed_at, end_col: end_col, end_line: end_line, path: path, start_col: start_col, start_line: start_line, url: url, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_code_location.rb', line 42 def self.names @_hash = {} if @_hash.nil? @_hash['committed_at'] = 'committedAt' @_hash['end_col'] = 'endCol' @_hash['end_line'] = 'endLine' @_hash['path'] = 'path' @_hash['start_col'] = 'startCol' @_hash['start_line'] = 'startLine' @_hash['url'] = 'url' @_hash end |
.nullables ⇒ Object
An array for nullable fields
68 69 70 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_code_location.rb', line 68 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_code_location.rb', line 55 def self.optionals %w[ committed_at end_col end_line path start_col start_line url ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
136 137 138 139 140 141 142 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_code_location.rb', line 136 def inspect class_name = self.class.name.split('::').last "<#{class_name} committed_at: #{@committed_at.inspect}, end_col: #{@end_col.inspect},"\ " end_line: #{@end_line.inspect}, path: #{@path.inspect}, start_col: #{@start_col.inspect},"\ " start_line: #{@start_line.inspect}, url: #{@url.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_committed_at ⇒ Object
123 124 125 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_code_location.rb', line 123 def to_custom_committed_at DateTimeHelper.to_rfc3339(committed_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
128 129 130 131 132 133 |
# File 'lib/semgrep_web_app/models/protos_sca_v1_code_location.rb', line 128 def to_s class_name = self.class.name.split('::').last "<#{class_name} committed_at: #{@committed_at}, end_col: #{@end_col}, end_line:"\ " #{@end_line}, path: #{@path}, start_col: #{@start_col}, start_line: #{@start_line}, url:"\ " #{@url}, additional_properties: #{@additional_properties}>" end |