Class: GitShizzle::IndexSpecifications::ExclusiveRange

Inherits:
Base
  • Object
show all
Defined in:
lib/git_shizzle/index_specifications/exclusive_range.rb

Instance Method Summary collapse

Methods inherited from Base

#matches, #register_match

Constructor Details

#initialize(index) ⇒ ExclusiveRange

Returns a new instance of ExclusiveRange.



5
6
7
8
9
10
# File 'lib/git_shizzle/index_specifications/exclusive_range.rb', line 5

def initialize(index)
  spec = index.split('...')
  assert_numeric index, *spec

  @range = ::Range.new(*spec.map(&:to_i)).to_a[0..-2]
end

Instance Method Details

#include?(index) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/git_shizzle/index_specifications/exclusive_range.rb', line 12

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

#inspectObject



20
21
22
# File 'lib/git_shizzle/index_specifications/exclusive_range.rb', line 20

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

#unmatchedObject



16
17
18
# File 'lib/git_shizzle/index_specifications/exclusive_range.rb', line 16

def unmatched
  @range - matches
end