Module: RangeOperators::RangeOperatorDefinitions

Included in:
Range
Defined in:
lib/range_operators/range_operator_definitions.rb

Overview

Values returned from the operations are in an array.

Instance Method Summary collapse

Instance Method Details

#+(value) ⇒ Object Also known as: plus



8
9
10
# File 'lib/range_operators/range_operator_definitions.rb', line 8

def +(value)
	[self, value].rangify
end

#-(value) ⇒ Object Also known as: minus



14
15
16
17
18
19
20
# File 'lib/range_operators/range_operator_definitions.rb', line 14

def -(value)
	if value.class == self.first.class
		self.minus_obj(value)
	else
		[self.minus_obj(value.first)[0], self.minus_obj(value.last)[1]].compact
	end
end