Class: Copyleaks::SubmissionFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/copyleaks/models/submissions/properties/filter.rb

Instance Method Summary collapse

Constructor Details

#initialize(identicalEnabled = true, minorChangesEnabled = false, relatedMeaningEnabled = false, minCopiedWords = nil, safeSearch = false, domains = [], domainsMode = SubmissionFilterDomainsMode::EXCLUDE, allowSameDomain = false) ⇒ SubmissionFilter

Returns a new instance of SubmissionFilter.

Parameters:

  • identicalEnabled (Boolean) (defaults to: true)

    Enable matching of exact words in the text.

  • minorChangesEnabled (Boolean) (defaults to: false)

    Enable matching of nearly identical words with small differences like slow becomes slowly.

  • relatedMeaningEnabled (Boolean) (defaults to: false)

    Enable matching of paraphrased content stating similar ideas with different words.

  • minCopiedWords (Integer) (defaults to: nil)

    Select results with at least minCopiedWords copied words.

  • safeSearch (Boolean) (defaults to: false)

    Block explicit adult content from the scan results such as web pages containing inappropriate images and videos. SafeSearch is not 100% effective with all websites.

  • domains (String[]) (defaults to: [])

    list of domains to either include or exclude from the scan - depending on the value of domainsMode.

  • domainsMode (SubmissionFilterDomainsMode) (defaults to: SubmissionFilterDomainsMode::EXCLUDE)

    Include or Exclude the list of domains you specified under the domains property

  • allowSameDomain (Boolean) (defaults to: false)

    when set to true it will allow results from the same domain as the submitted url.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/copyleaks/models/submissions/properties/filter.rb', line 34

def initialize(
  identicalEnabled = true,
  minorChangesEnabled = false,
  relatedMeaningEnabled = false,
  minCopiedWords = nil,
  safeSearch = false,
  domains = [],
  domainsMode = SubmissionFilterDomainsMode::EXCLUDE,
  allowSameDomain = false
)
  @identicalEnabled = identicalEnabled
  @minorChangesEnabled = minorChangesEnabled
  @relatedMeaningEnabled = relatedMeaningEnabled
  @minCopiedWords = minCopiedWords
  @safeSearch = safeSearch
  @domains = domains
  @domainsMode = domainsMode
  @allowSameDomain = allowSameDomain
end

Instance Method Details

#as_json(*_args) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/copyleaks/models/submissions/properties/filter.rb', line 54

def as_json(*_args)
  {
    identicalEnabled: @identicalEnabled,
    minorChangesEnabled: @minorChangesEnabled,
    relatedMeaningEnabled: @relatedMeaningEnabled,
    minCopiedWords: @minCopiedWords,
    safeSearch: @safeSearch,
    domains: @domains,
    domainsMode: @domainsMode,
    allowSameDomain: @allowSameDomain
  }.select { |_k, v| !v.nil? }
end

#to_json(*options) ⇒ Object



67
68
69
# File 'lib/copyleaks/models/submissions/properties/filter.rb', line 67

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