Sha256: c47130e8bd435081bca0880d69c69d704d497c6e7ff3ca76dd8faac17c8d9273
Contents?: true
Size: 659 Bytes
Versions: 7
Compression:
Stored size: 659 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
7 entries across 7 versions & 1 rubygems