Sha256: 7790d9f4a9a33d928947a403f0ba469545e8cb6e1b6ef0242ac0cf9c5da34315
Contents?: true
Size: 660 Bytes
Versions: 4
Compression:
Stored size: 660 Bytes
Contents
# frozen_string_literal: true require 'pathname' module RubyCritic class Location attr_reader :pathname, :line def initialize(path, line) @pathname = Pathname.new(path) @line = line.to_i end def file_name @pathname.basename.sub_ext('').to_s end def to_s "#{pathname}:#{line}" end def to_h { path: pathname.to_s, line: line } end def to_json(*a) to_h.to_json(*a) end def ==(other) state == other.state end def <=>(other) state <=> other.state end protected def state [@pathname, @line] end end end
Version data entries
4 entries across 4 versions & 1 rubygems