Class: Copyleaks::CopyleaksAiImageDetectionResultModel
- Inherits:
-
Object
- Object
- Copyleaks::CopyleaksAiImageDetectionResultModel
- Defined in:
- lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionResultModel.rb
Overview
RLE-encoded mask data for AI-detected regions.
Instance Attribute Summary collapse
-
#lengths ⇒ Object
Lengths of AI-detected segments corresponding to each start position.
-
#starts ⇒ Object
Start positions of AI-detected segments in the flattened image array.
Class Method Summary collapse
-
.from_json(json_hash) ⇒ Object
Create instance from JSON hash.
Instance Method Summary collapse
-
#initialize(starts: nil, lengths: nil) ⇒ CopyleaksAiImageDetectionResultModel
constructor
Initialize a new CopyleaksAiImageDetectionResultModel.
-
#to_json(*args) ⇒ Object
Convert to JSON.
Constructor Details
#initialize(starts: nil, lengths: nil) ⇒ CopyleaksAiImageDetectionResultModel
Initialize a new CopyleaksAiImageDetectionResultModel
40 41 42 43 |
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionResultModel.rb', line 40 def initialize(starts: nil, lengths: nil) @starts = starts @lengths = lengths end |
Instance Attribute Details
#lengths ⇒ Object
Lengths of AI-detected segments corresponding to each start position.
34 35 36 |
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionResultModel.rb', line 34 def lengths @lengths end |
#starts ⇒ Object
Start positions of AI-detected segments in the flattened image array.
31 32 33 |
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionResultModel.rb', line 31 def starts @starts end |
Class Method Details
.from_json(json_hash) ⇒ Object
Create instance from JSON hash
46 47 48 49 50 51 52 53 |
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionResultModel.rb', line 46 def self.from_json(json_hash) return nil if json_hash.nil? new( starts: json_hash['starts'], lengths: json_hash['lengths'] ) end |
Instance Method Details
#to_json(*args) ⇒ Object
Convert to JSON
56 57 58 59 60 61 |
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionResultModel.rb', line 56 def to_json(*args) { 'starts' => @starts, 'lengths' => @lengths }.to_json(*args) end |