Class: Copyleaks::SourceCodeSubmissionModel
- Inherits:
-
AIDetectionSubmissionModel
- Object
- AIDetectionSubmissionModel
- Copyleaks::SourceCodeSubmissionModel
- Defined in:
- lib/copyleaks/models/submissions/ai_detection/source_code_submission_model.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
Returns the value of attribute filename.
Attributes inherited from AIDetectionSubmissionModel
Instance Method Summary collapse
- #as_json(*_args) ⇒ Object
-
#initialize(text, filename, sandbox = false) ⇒ SourceCodeSubmissionModel
constructor
A new instance of SourceCodeSubmissionModel.
- #to_json(*options) ⇒ Object
Constructor Details
#initialize(text, filename, sandbox = false) ⇒ SourceCodeSubmissionModel
Returns a new instance of SourceCodeSubmissionModel.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/copyleaks/models/submissions/ai_detection/source_code_submission_model.rb', line 32 def initialize(text, filename, sandbox = false) unless text.instance_of?(String) raise 'Copyleaks::SourceCodeSubmissionModel - text - text must be of type String' end unless filename.instance_of?(String) raise 'Copyleaks::SourceCodeSubmissionModel - filename - filename must be of type String' end super(text, sandbox) @filename = filename end |
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename.
27 28 29 |
# File 'lib/copyleaks/models/submissions/ai_detection/source_code_submission_model.rb', line 27 def filename @filename end |
Instance Method Details
#as_json(*_args) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/copyleaks/models/submissions/ai_detection/source_code_submission_model.rb', line 43 def as_json(*_args) { text: @text, sandbox: @sandbox, filename: @filename }.select { |_k, v| !v.nil? } end |
#to_json(*options) ⇒ Object
51 52 53 |
# File 'lib/copyleaks/models/submissions/ai_detection/source_code_submission_model.rb', line 51 def to_json(*) as_json(*).to_json(*) end |