class RubyCritic::Location
Attributes
line[R]
pathname[R]
Public Class Methods
new(path, line)
click to toggle source
# File lib/rubycritic/core/location.rb, line 9 def initialize(path, line) @pathname = Pathname.new(path) @line = line.to_i end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/rubycritic/core/location.rb, line 37 def <=>(other) state <=> other.state end
==(other)
click to toggle source
# File lib/rubycritic/core/location.rb, line 33 def ==(other) state == other.state end
file_name()
click to toggle source
# File lib/rubycritic/core/location.rb, line 14 def file_name @pathname.basename.sub_ext('').to_s end
to_h()
click to toggle source
# File lib/rubycritic/core/location.rb, line 22 def to_h { path: pathname.to_s, line: line } end
to_json(*options)
click to toggle source
# File lib/rubycritic/core/location.rb, line 29 def to_json(*options) to_h.to_json(*options) end
to_s()
click to toggle source
# File lib/rubycritic/core/location.rb, line 18 def to_s "#{pathname}:#{line}" end
Protected Instance Methods
state()
click to toggle source
# File lib/rubycritic/core/location.rb, line 43 def state [@pathname, @line] end