Sha256: 667f843bade44787eb7fe530cc7cda348b0a97c45016a6b29097c677ab3fa4ee

Contents?: true

Size: 449 Bytes

Versions: 2

Compression:

Stored size: 449 Bytes

Contents

# -*- encoding: utf-8 -*-

module GitShizzle::IndexSpecifications
  class Range < Base
    def initialize(index)
      spec = index.split('..')
      assert_numeric index, *spec

      @range = ::Range.new(*spec.map(&:to_i)).to_a
    end

    def include?(index)
      @range.include? index
    end

    def unmatched
      @range - matches
    end

    def inspect
      "#{self.class}: #{@range.inspect}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
git_shizzle-0.2.8 lib/git_shizzle/index_specifications/range.rb
git_shizzle-0.2.6 lib/git_shizzle/index_specifications/range.rb