Class: Copyleaks::Database

Inherits:
SharedResultsModel show all
Defined in:
lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Database.rb

Instance Attribute Summary collapse

Attributes inherited from SharedResultsModel

#id, #introduction, #matchedWords, #metadata, #scanId, #title

Instance Method Summary collapse

Constructor Details

#initialize(tags:, **options) ⇒ Database

Returns a new instance of Database.

Parameters:

  • tags (Array<Tags>)
    • Tags object array



26
27
28
29
30
31
32
33
34
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Database.rb', line 26

def initialize(tags:, **options)
  unless tags.is_a?(Array) && tags.all? { |tag| tag.is_a?(Tags) }
    raise 'Copyleaks::Database - tags must be an Array of Tags'
  end

  super(**options) # Pass any other options to SharedResultsModel

  @tags = tags
end

Instance Attribute Details

#tagsObject (readonly)

Returns the value of attribute tags.



23
24
25
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Database.rb', line 23

def tags
  @tags
end

Instance Method Details

#as_json(*_args) ⇒ Object



36
37
38
39
40
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Database.rb', line 36

def as_json(*_args)
  {
    tags: @tags
  }
end

#to_json(*options) ⇒ Object



42
43
44
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Database.rb', line 42

def to_json(*options)
  as_json(*options).to_json(*options)
end