Class: PmdTester::DuplicationFileInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/pmdtester/parsers/cpd_report_document.rb

Overview

Represents a single file location of a duplication in a CPD report

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, location:, begintoken:, endtoken:) ⇒ DuplicationFileInfo

Returns a new instance of DuplicationFileInfo.



221
222
223
224
225
226
# File 'lib/pmdtester/parsers/cpd_report_document.rb', line 221

def initialize(path:, location:, begintoken:, endtoken:)
  @path = path
  @location = location
  @begintoken = begintoken
  @endtoken = endtoken
end

Instance Attribute Details

#begintokenObject (readonly)

Returns the value of attribute begintoken.



219
220
221
# File 'lib/pmdtester/parsers/cpd_report_document.rb', line 219

def begintoken
  @begintoken
end

#endtokenObject (readonly)

Returns the value of attribute endtoken.



219
220
221
# File 'lib/pmdtester/parsers/cpd_report_document.rb', line 219

def endtoken
  @endtoken
end

#locationObject (readonly)

Returns the value of attribute location.



219
220
221
# File 'lib/pmdtester/parsers/cpd_report_document.rb', line 219

def location
  @location
end

#pathObject (readonly)

Returns the value of attribute path.



219
220
221
# File 'lib/pmdtester/parsers/cpd_report_document.rb', line 219

def path
  @path
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


228
229
230
231
232
233
234
235
# File 'lib/pmdtester/parsers/cpd_report_document.rb', line 228

def eql?(other)
  return false unless other.is_a?(DuplicationFileInfo)

  path == other.path &&
    location.eql?(other.location) &&
    begintoken == other.begintoken &&
    endtoken == other.endtoken
end

#hashObject



237
238
239
# File 'lib/pmdtester/parsers/cpd_report_document.rb', line 237

def hash
  [path, location, begintoken, endtoken].hash
end