Sha256: 842205ac95c92ab1599737456ac23f24443f2e16334f282c55692912d8d31014

Contents?: true

Size: 466 Bytes

Versions: 2

Compression:

Stored size: 466 Bytes

Contents

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

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

      @range = ::Range.new(*spec.map(&:to_i)).to_a[0..-2]
    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/exclusive_range.rb
git_shizzle-0.2.6 lib/git_shizzle/index_specifications/exclusive_range.rb