Class: Copyleaks::Results
- Inherits:
-
Object
- Object
- Copyleaks::Results
- Defined in:
- lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Results.rb
Instance Attribute Summary collapse
-
#batch ⇒ Object
readonly
Returns the value of attribute batch.
-
#database ⇒ Object
readonly
Returns the value of attribute database.
-
#internet ⇒ Object
readonly
Returns the value of attribute internet.
-
#repositories ⇒ Object
readonly
Returns the value of attribute repositories.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
Instance Method Summary collapse
- #as_json(*_args) ⇒ Object
-
#initialize(database: nil, batch: nil, repositories: nil, score: nil, internet: nil) ⇒ Results
constructor
A new instance of Results.
- #to_json(*options) ⇒ Object
Constructor Details
#initialize(database: nil, batch: nil, repositories: nil, score: nil, internet: nil) ⇒ Results
Returns a new instance of Results.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Results.rb', line 30 def initialize(database: nil, batch: nil, repositories: nil, score: nil, internet: nil) if !database.nil? && !(database.is_a?(Array) && database.all? { |d| d.is_a?(Database) }) raise 'Copyleaks::Results - database must be an array of Database objects' end if !batch.nil? && !(batch.is_a?(Array) && batch.all? { |b| b.is_a?(Batch) }) raise 'Copyleaks::Results - batch must be an array of Batch objects' end if !repositories.nil? && !(repositories.is_a?(Array) && repositories.all? { |r| r.is_a?(Repositories) }) raise 'Copyleaks::Results - repositories must be an array of Repositories objects' end if !score.nil? && !score.is_a?(Score) raise 'Copyleaks::Results - score must be a Score object' end if !internet.nil? && !(internet.is_a?(Array) && internet.all? { |i| i.is_a?(Internet) }) raise 'Copyleaks::Results - internet must be an array of Internet objects' end @database = database @batch = batch @repositories = repositories @score = score @internet = internet end |
Instance Attribute Details
#batch ⇒ Object (readonly)
Returns the value of attribute batch.
23 24 25 |
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Results.rb', line 23 def batch @batch end |
#database ⇒ Object (readonly)
Returns the value of attribute database.
23 24 25 |
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Results.rb', line 23 def database @database end |
#internet ⇒ Object (readonly)
Returns the value of attribute internet.
23 24 25 |
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Results.rb', line 23 def internet @internet end |
#repositories ⇒ Object (readonly)
Returns the value of attribute repositories.
23 24 25 |
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Results.rb', line 23 def repositories @repositories end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
23 24 25 |
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Results.rb', line 23 def score @score end |
Instance Method Details
#as_json(*_args) ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Results.rb', line 54 def as_json(*_args) { database: @database, batch: @batch, repositories: @repositories, score: @score, internet: @internet }.select { |_k, v| !v.nil? } end |
#to_json(*options) ⇒ Object
64 65 66 |
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/CompletedModels/Results.rb', line 64 def to_json(*) as_json(*).to_json(*) end |