Module: IntervalNotation::Syntax::Short
- Defined in:
- lib/interval_notation.rb
Overview
Long syntax for interval factory methods
Constant Summary collapse
- R =
::IntervalNotation::R
- Empty =
::IntervalNotation::Empty
Class Method Summary collapse
- .cc(from, to) ⇒ Object
- .co(from, to) ⇒ Object
- .ge(value) ⇒ Object
- .gt(value) ⇒ Object
- .int(str) ⇒ Object
- .le(value) ⇒ Object
- .lt(value) ⇒ Object
- .oc(from, to) ⇒ Object
- .oo(from, to) ⇒ Object
- .pt(value) ⇒ Object
Class Method Details
.cc(from, to) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/interval_notation.rb', line 40 def cc(from, to) if from != to IntervalSet.new_unsafe( [BasicIntervals::ClosedClosedInterval.new(from, to)] ) else IntervalSet.new_unsafe( [BasicIntervals::Point.new(from)] ) end end |
.co(from, to) ⇒ Object
32 33 34 |
# File 'lib/interval_notation.rb', line 32 def co(from, to) IntervalSet.new_unsafe( [BasicIntervals::ClosedOpenInterval.new(from, to)] ) end |
.ge(value) ⇒ Object
64 65 66 |
# File 'lib/interval_notation.rb', line 64 def ge(value) IntervalSet.new_unsafe( [BasicIntervals::ClosedOpenInterval.new(value, Float::INFINITY)] ) end |
.gt(value) ⇒ Object
60 61 62 |
# File 'lib/interval_notation.rb', line 60 def gt(value) IntervalSet.new_unsafe( [BasicIntervals::OpenOpenInterval.new(value, Float::INFINITY)] ) end |
.int(str) ⇒ Object
24 25 26 |
# File 'lib/interval_notation.rb', line 24 def int(str) IntervalSet.from_string(str) end |
.le(value) ⇒ Object
56 57 58 |
# File 'lib/interval_notation.rb', line 56 def le(value) IntervalSet.new_unsafe( [BasicIntervals::OpenClosedInterval.new(-Float::INFINITY, value)] ) end |
.lt(value) ⇒ Object
52 53 54 |
# File 'lib/interval_notation.rb', line 52 def lt(value) IntervalSet.new_unsafe( [BasicIntervals::OpenOpenInterval.new(-Float::INFINITY, value)] ) end |
.oc(from, to) ⇒ Object
36 37 38 |
# File 'lib/interval_notation.rb', line 36 def oc(from, to) IntervalSet.new_unsafe( [BasicIntervals::OpenClosedInterval.new(from, to)] ) end |
.oo(from, to) ⇒ Object
28 29 30 |
# File 'lib/interval_notation.rb', line 28 def oo(from, to) IntervalSet.new_unsafe( [BasicIntervals::OpenOpenInterval.new(from, to)] ) end |
.pt(value) ⇒ Object
48 49 50 |
# File 'lib/interval_notation.rb', line 48 def pt(value) IntervalSet.new_unsafe( [BasicIntervals::Point.new(value)] ) end |