lib/interval_notation.rb in interval_notation-0.1.1 vs lib/interval_notation.rb in interval_notation-0.1.2
- old
+ new
@@ -36,11 +36,15 @@
def oc(from, to)
IntervalSet.new_unsafe( [BasicIntervals::OpenClosedInterval.new(from, to)] )
end
def cc(from, to)
- IntervalSet.new_unsafe( [BasicIntervals::ClosedClosedInterval.new(from, to)] )
+ if from != to
+ IntervalSet.new_unsafe( [BasicIntervals::ClosedClosedInterval.new(from, to)] )
+ else
+ IntervalSet.new_unsafe( [BasicIntervals::Point.new(from)] )
+ end
end
def pt(value)
IntervalSet.new_unsafe( [BasicIntervals::Point.new(value)] )
end
@@ -84,10 +88,14 @@
def open_closed(from, to)
IntervalSet.new_unsafe( [BasicIntervals::OpenClosedInterval.new(from, to)] )
end
def closed_closed(from, to)
- IntervalSet.new_unsafe( [BasicIntervals::ClosedClosedInterval.new(from, to)] )
+ if from != to
+ IntervalSet.new_unsafe( [BasicIntervals::ClosedClosedInterval.new(from, to)] )
+ else
+ IntervalSet.new_unsafe( [BasicIntervals::Point.new(from)] )
+ end
end
def point(value)
IntervalSet.new_unsafe( [BasicIntervals::Point.new(value)] )
end