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
- .cc_basic(from, to) ⇒ Object
- .co(from, to) ⇒ Object
- .co_basic(from, to) ⇒ Object
- .ge(value) ⇒ Object
- .ge_basic(value) ⇒ Object
- .gt(value) ⇒ Object
- .gt_basic(value) ⇒ Object
- .interval(str) ⇒ Object
- .le(value) ⇒ Object
- .le_basic(value) ⇒ Object
- .lt(value) ⇒ Object
- .lt_basic(value) ⇒ Object
- .oc(from, to) ⇒ Object
- .oc_basic(from, to) ⇒ Object
- .oo(from, to) ⇒ Object
- .oo_basic(from, to) ⇒ Object
- .pt(value) ⇒ Object
- .pt_basic(value) ⇒ Object
Class Method Details
.cc(from, to) ⇒ Object
73 |
# File 'lib/interval_notation.rb', line 73 def cc(from, to); IntervalSet.new_unsafe( [cc_basic(from, to)] ); end |
.cc_basic(from, to) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/interval_notation.rb', line 36 def cc_basic(from, to) if from != to BasicIntervals::ClosedClosedInterval.new(from, to) else BasicIntervals::Point.new(from) end end |
.co(from, to) ⇒ Object
71 |
# File 'lib/interval_notation.rb', line 71 def co(from, to); IntervalSet.new_unsafe( [co_basic(from, to)] ); end |
.co_basic(from, to) ⇒ Object
28 29 30 |
# File 'lib/interval_notation.rb', line 28 def co_basic(from, to) BasicIntervals::ClosedOpenInterval.new(from, to) end |
.ge(value) ⇒ Object
78 |
# File 'lib/interval_notation.rb', line 78 def ge(value); IntervalSet.new_unsafe( [ge_basic(value)] ); end |
.ge_basic(value) ⇒ Object
60 61 62 |
# File 'lib/interval_notation.rb', line 60 def ge_basic(value) BasicIntervals::ClosedOpenInterval.new(value, Float::INFINITY) end |
.gt(value) ⇒ Object
77 |
# File 'lib/interval_notation.rb', line 77 def gt(value); IntervalSet.new_unsafe( [gt_basic(value)] ); end |
.gt_basic(value) ⇒ Object
56 57 58 |
# File 'lib/interval_notation.rb', line 56 def gt_basic(value) BasicIntervals::OpenOpenInterval.new(value, Float::INFINITY) end |
.interval(str) ⇒ Object
66 67 68 |
# File 'lib/interval_notation.rb', line 66 def interval(str) IntervalSet.from_string(str) end |
.le(value) ⇒ Object
76 |
# File 'lib/interval_notation.rb', line 76 def le(value); IntervalSet.new_unsafe( [le_basic(value)] ); end |
.le_basic(value) ⇒ Object
52 53 54 |
# File 'lib/interval_notation.rb', line 52 def le_basic(value) BasicIntervals::OpenClosedInterval.new(-Float::INFINITY, value) end |
.lt(value) ⇒ Object
75 |
# File 'lib/interval_notation.rb', line 75 def lt(value); IntervalSet.new_unsafe( [lt_basic(value)] ); end |
.lt_basic(value) ⇒ Object
48 49 50 |
# File 'lib/interval_notation.rb', line 48 def lt_basic(value) BasicIntervals::OpenOpenInterval.new(-Float::INFINITY, value) end |
.oc(from, to) ⇒ Object
72 |
# File 'lib/interval_notation.rb', line 72 def oc(from, to); IntervalSet.new_unsafe( [oc_basic(from, to)] ); end |
.oc_basic(from, to) ⇒ Object
32 33 34 |
# File 'lib/interval_notation.rb', line 32 def oc_basic(from, to) BasicIntervals::OpenClosedInterval.new(from, to) end |
.oo(from, to) ⇒ Object
70 |
# File 'lib/interval_notation.rb', line 70 def oo(from, to); IntervalSet.new_unsafe( [oo_basic(from, to)] ); end |
.oo_basic(from, to) ⇒ Object
24 25 26 |
# File 'lib/interval_notation.rb', line 24 def oo_basic(from, to) BasicIntervals::OpenOpenInterval.new(from, to) end |
.pt(value) ⇒ Object
74 |
# File 'lib/interval_notation.rb', line 74 def pt(value); IntervalSet.new_unsafe( [pt_basic(value)] ); end |
.pt_basic(value) ⇒ Object
44 45 46 |
# File 'lib/interval_notation.rb', line 44 def pt_basic(value) BasicIntervals::Point.new(value) end |