Module: IntervalNotation::Syntax::Long
- 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
- .closed_closed(from, to) ⇒ Object
- .closed_closed_basic(from, to) ⇒ Object
- .closed_open(from, to) ⇒ Object
- .closed_open_basic(from, to) ⇒ Object
- .greater_than(value) ⇒ Object
- .greater_than_basic(value) ⇒ Object
- .greater_than_or_equal_to(value) ⇒ Object
- .greater_than_or_equal_to_basic(value) ⇒ Object
- .interval(str) ⇒ Object
- .less_than(value) ⇒ Object
- .less_than_basic(value) ⇒ Object
- .less_than_or_equal_to(value) ⇒ Object
- .less_than_or_equal_to_basic(value) ⇒ Object
- .open_closed(from, to) ⇒ Object
- .open_closed_basic(from, to) ⇒ Object
- .open_open(from, to) ⇒ Object
- .open_open_basic(from, to) ⇒ Object
- .point(value) ⇒ Object
- .point_basic(value) ⇒ Object
Class Method Details
.closed_closed(from, to) ⇒ Object
137 |
# File 'lib/interval_notation.rb', line 137 def closed_closed(from, to); IntervalSet.new_unsafe([ closed_closed_basic(from, to) ]); end |
.closed_closed_basic(from, to) ⇒ Object
99 100 101 102 103 104 105 |
# File 'lib/interval_notation.rb', line 99 def closed_closed_basic(from, to) if from != to BasicIntervals::ClosedClosedInterval.new(from, to) else BasicIntervals::Point.new(from) end end |
.closed_open(from, to) ⇒ Object
135 |
# File 'lib/interval_notation.rb', line 135 def closed_open(from, to); IntervalSet.new_unsafe([ closed_open_basic(from, to) ]); end |
.closed_open_basic(from, to) ⇒ Object
91 92 93 |
# File 'lib/interval_notation.rb', line 91 def closed_open_basic(from, to) BasicIntervals::ClosedOpenInterval.new(from, to) end |
.greater_than(value) ⇒ Object
141 |
# File 'lib/interval_notation.rb', line 141 def greater_than(value); IntervalSet.new_unsafe([ greater_than_basic(value) ]); end |
.greater_than_basic(value) ⇒ Object
119 120 121 |
# File 'lib/interval_notation.rb', line 119 def greater_than_basic(value) BasicIntervals::OpenOpenInterval.new(value, Float::INFINITY) end |
.greater_than_or_equal_to(value) ⇒ Object
142 |
# File 'lib/interval_notation.rb', line 142 def greater_than_or_equal_to(value); IntervalSet.new_unsafe([ greater_than_or_equal_to_basic(value) ]); end |
.greater_than_or_equal_to_basic(value) ⇒ Object
123 124 125 |
# File 'lib/interval_notation.rb', line 123 def greater_than_or_equal_to_basic(value) BasicIntervals::ClosedOpenInterval.new(value, Float::INFINITY) end |
.interval(str) ⇒ Object
130 131 132 |
# File 'lib/interval_notation.rb', line 130 def interval(str) IntervalSet.from_string(str) end |
.less_than(value) ⇒ Object
139 |
# File 'lib/interval_notation.rb', line 139 def less_than(value); IntervalSet.new_unsafe([ less_than_basic(value) ]); end |
.less_than_basic(value) ⇒ Object
111 112 113 |
# File 'lib/interval_notation.rb', line 111 def less_than_basic(value) BasicIntervals::OpenOpenInterval.new(-Float::INFINITY, value) end |
.less_than_or_equal_to(value) ⇒ Object
140 |
# File 'lib/interval_notation.rb', line 140 def less_than_or_equal_to(value); IntervalSet.new_unsafe([ less_than_or_equal_to_basic(value) ]); end |
.less_than_or_equal_to_basic(value) ⇒ Object
115 116 117 |
# File 'lib/interval_notation.rb', line 115 def less_than_or_equal_to_basic(value) BasicIntervals::OpenClosedInterval.new(-Float::INFINITY, value) end |
.open_closed(from, to) ⇒ Object
136 |
# File 'lib/interval_notation.rb', line 136 def open_closed(from, to); IntervalSet.new_unsafe([ open_closed_basic(from, to) ]); end |
.open_closed_basic(from, to) ⇒ Object
95 96 97 |
# File 'lib/interval_notation.rb', line 95 def open_closed_basic(from, to) BasicIntervals::OpenClosedInterval.new(from, to) end |
.open_open(from, to) ⇒ Object
134 |
# File 'lib/interval_notation.rb', line 134 def open_open(from, to); IntervalSet.new_unsafe([ open_open_basic(from, to) ]); end |
.open_open_basic(from, to) ⇒ Object
87 88 89 |
# File 'lib/interval_notation.rb', line 87 def open_open_basic(from, to) BasicIntervals::OpenOpenInterval.new(from, to) end |
.point(value) ⇒ Object
138 |
# File 'lib/interval_notation.rb', line 138 def point(value); IntervalSet.new_unsafe([ point_basic(value) ]); end |
.point_basic(value) ⇒ Object
107 108 109 |
# File 'lib/interval_notation.rb', line 107 def point_basic(value) BasicIntervals::Point.new(value) end |