Class: RubyAppraiser::Defect
- Inherits:
-
Object
- Object
- RubyAppraiser::Defect
- Defined in:
- lib/ruby-appraiser/defect.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
- #file ⇒ Object
-
#initialize(file, line, description) ⇒ Defect
constructor
A new instance of Defect.
- #line ⇒ Object
- #to_s ⇒ Object
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
#description ⇒ Object (readonly)
Returns the value of attribute description.
11 12 13 |
# File 'lib/ruby-appraiser/defect.rb', line 11 def description @description end |
#location ⇒ Object (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 |
#file ⇒ Object
13 14 15 |
# File 'lib/ruby-appraiser/defect.rb', line 13 def file @location[0] end |
#line ⇒ Object
17 18 19 |
# File 'lib/ruby-appraiser/defect.rb', line 17 def line @location[1] end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/ruby-appraiser/defect.rb', line 21 def to_s "#{file}:#{line} #{description}" end |