Sha256: efb4b7f4478c4d0315277ef5f64b2ed37296b5a4d651ab593151dfa6d6e7cd61

Contents?: true

Size: 493 Bytes

Versions: 10

Compression:

Stored size: 493 Bytes

Contents

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 ==(other)
      state == other.state
    end

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

    protected

    def state
      [@pathname, @line]
    end
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rubycritic-1.3.0 lib/rubycritic/core/location.rb
rubycritic-1.2.1 lib/rubycritic/core/location.rb
rubycritic-1.2.0 lib/rubycritic/core/location.rb
rubycritic-1.1.1 lib/rubycritic/core/location.rb
rubycritic-1.1.0 lib/rubycritic/core/location.rb
rubycritic-1.0.2 lib/rubycritic/core/location.rb
rubycritic-1.0.1 lib/rubycritic/core/location.rb
rubycritic-1.0.0 lib/rubycritic/core/location.rb
rubycritic-0.0.16 lib/rubycritic/core/location.rb
rubycritic-0.0.15 lib/rubycritic/core/location.rb