Sha256: 66c1cb5e0a2a01a56975a2c348d604eecb9b1e5b3a321af306a9b3ea2fd5b933

Contents?: true

Size: 448 Bytes

Versions: 3

Compression:

Stored size: 448 Bytes

Contents

require "pathname"

module Rubycritic

  class Location
    attr_reader :pathname, :line

    def initialize(path, line)
      @pathname = Pathname.new(path)
      @line = line
    end

    def to_s
      "#{pathname}:#{line}"
    end

    def ==(other)
      self.class == other.class && state == other.state
    end

    def <=>(other)
      state <=> other.state
    end

    protected

    def state
      [@pathname, @line]
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubycritic-0.0.7 lib/rubycritic/location.rb
rubycritic-0.0.6 lib/rubycritic/location.rb
rubycritic-0.0.5 lib/rubycritic/location.rb