Class: Copyleaks::Internet

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

Instance Attribute Summary collapse

Attributes inherited from NewResultsInternet

#id, #introduction, #matchedWords, #metadata, #title, #url

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Internet.

Parameters:

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



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

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

  super(**options)  # Initialize parent class with other params
  @tags = tags
end

Instance Attribute Details

#tagsObject (readonly)

Returns the value of attribute tags.



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

def tags
  @tags
end

Instance Method Details

#as_json(*_args) ⇒ Object



34
35
36
# File 'lib/copyleaks/models/submissions/webhooks/HelperModels/ResultsModels/Internet.rb', line 34

def as_json(*_args)
  super.merge(tags: @tags)
end

#to_json(*options) ⇒ Object



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

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