Class: IntervalNotation::SubtractCombiner

Inherits:
Combiner
  • Object
show all
Defined in:
lib/interval_notation/combiners.rb

Instance Attribute Summary collapse

Attributes inherited from Combiner

#num_interval_sets, #previous_state

Instance Method Summary collapse

Methods inherited from Combiner

#combine, #pass

Constructor Details

#initializeSubtractCombiner

Returns a new instance of SubtractCombiner.



119
120
121
122
# File 'lib/interval_notation/combiners.rb', line 119

def initialize
  @include_last_point = nil
  @inside = [false, false]
end

Instance Attribute Details

#include_last_pointObject (readonly)

checks whether last passed point should be included



117
118
119
# File 'lib/interval_notation/combiners.rb', line 117

def include_last_point
  @include_last_point
end

Instance Method Details

#stateObject

checks whether current section should be included



125
126
127
# File 'lib/interval_notation/combiners.rb', line 125

def state
  @inside[0] && ! @inside[1]
end