Class: PmdTester::Location
- Inherits:
-
Object
- Object
- PmdTester::Location
- Defined in:
- lib/pmdtester/location.rb
Overview
This class represents a location in a source file
Instance Attribute Summary collapse
-
#begincolumn ⇒ Object
readonly
Returns the value of attribute begincolumn.
-
#beginline ⇒ Object
readonly
Returns the value of attribute beginline.
-
#endcolumn ⇒ Object
readonly
Returns the value of attribute endcolumn.
-
#endline ⇒ Object
readonly
Returns the value of attribute endline.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(beginline:, endline:, begincolumn:, endcolumn:) ⇒ Location
constructor
A new instance of Location.
- #to_s ⇒ Object
Constructor Details
#initialize(beginline:, endline:, begincolumn:, endcolumn:) ⇒ Location
Returns a new instance of Location.
8 9 10 11 12 13 |
# File 'lib/pmdtester/location.rb', line 8 def initialize(beginline:, endline:, begincolumn:, endcolumn:) @beginline = beginline @endline = endline @begincolumn = begincolumn @endcolumn = endcolumn end |
Instance Attribute Details
#begincolumn ⇒ Object (readonly)
Returns the value of attribute begincolumn.
6 7 8 |
# File 'lib/pmdtester/location.rb', line 6 def begincolumn @begincolumn end |
#beginline ⇒ Object (readonly)
Returns the value of attribute beginline.
6 7 8 |
# File 'lib/pmdtester/location.rb', line 6 def beginline @beginline end |
#endcolumn ⇒ Object (readonly)
Returns the value of attribute endcolumn.
6 7 8 |
# File 'lib/pmdtester/location.rb', line 6 def endcolumn @endcolumn end |
#endline ⇒ Object (readonly)
Returns the value of attribute endline.
6 7 8 |
# File 'lib/pmdtester/location.rb', line 6 def endline @endline end |
Instance Method Details
#eql?(other) ⇒ Boolean
15 16 17 18 19 20 |
# File 'lib/pmdtester/location.rb', line 15 def eql?(other) beginline == other.beginline && endline == other.endline && begincolumn == other.begincolumn && endcolumn == other.endcolumn end |
#hash ⇒ Object
22 23 24 |
# File 'lib/pmdtester/location.rb', line 22 def hash [beginline, endline, begincolumn, endcolumn].hash end |
#to_s ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/pmdtester/location.rb', line 26 def to_s if beginline == endline if begincolumn == endcolumn "#{beginline}:#{begincolumn}" else "#{beginline}:#{begincolumn}-#{endcolumn}" end else "#{beginline}:#{begincolumn}-#{endline}:#{endcolumn}" end end |