Class: RubyAppraiser::Defect

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-appraiser/defect.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, line, description) ⇒ Defect



5
6
7
8
# File 'lib/ruby-appraiser/defect.rb', line 5

def initialize(file, line, description)
  @location = [file, line.to_i].freeze
  @description = description.dup.freeze
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



11
12
13
# File 'lib/ruby-appraiser/defect.rb', line 11

def description
  @description
end

#locationObject (readonly)

Returns the value of attribute location.



10
11
12
# File 'lib/ruby-appraiser/defect.rb', line 10

def location
  @location
end

Instance Method Details

#<=>(other) ⇒ Object



29
30
31
# File 'lib/ruby-appraiser/defect.rb', line 29

def <=>(other)
  self.to_s <=> other.to_s
end

#==(other) ⇒ Object



25
26
27
# File 'lib/ruby-appraiser/defect.rb', line 25

def ==(other)
  self.to_s == other.to_s
end

#fileObject



13
14
15
# File 'lib/ruby-appraiser/defect.rb', line 13

def file
  @location[0]
end

#lineObject



17
18
19
# File 'lib/ruby-appraiser/defect.rb', line 17

def line
  @location[1]
end

#to_sObject



21
22
23
# File 'lib/ruby-appraiser/defect.rb', line 21

def to_s
  "#{file}:#{line} #{description}"
end