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

Class Method Details

.closed_closed(from, to) ⇒ Object



92
93
94
95
96
97
98
# File 'lib/interval_notation.rb', line 92

def closed_closed(from, to)
  if from != to
    IntervalSet.new_unsafe( [BasicIntervals::ClosedClosedInterval.new(from, to)] )
  else
    IntervalSet.new_unsafe( [BasicIntervals::Point.new(from)] )
  end
end

.closed_open(from, to) ⇒ Object



84
85
86
# File 'lib/interval_notation.rb', line 84

def closed_open(from, to)
  IntervalSet.new_unsafe( [BasicIntervals::ClosedOpenInterval.new(from, to)] )
end

.greater_than(value) ⇒ Object



112
113
114
# File 'lib/interval_notation.rb', line 112

def greater_than(value)
  IntervalSet.new_unsafe( [BasicIntervals::OpenOpenInterval.new(value, Float::INFINITY)] )
end

.greater_than_or_equal_to(value) ⇒ Object



116
117
118
# File 'lib/interval_notation.rb', line 116

def greater_than_or_equal_to(value)
  IntervalSet.new_unsafe( [BasicIntervals::ClosedOpenInterval.new(value, Float::INFINITY)] )
end

.interval(str) ⇒ Object



76
77
78
# File 'lib/interval_notation.rb', line 76

def interval(str)
  IntervalSet.from_string(str)
end

.less_than(value) ⇒ Object



104
105
106
# File 'lib/interval_notation.rb', line 104

def less_than(value)
  IntervalSet.new_unsafe( [BasicIntervals::OpenOpenInterval.new(-Float::INFINITY, value)] )
end

.less_than_or_equal_to(value) ⇒ Object



108
109
110
# File 'lib/interval_notation.rb', line 108

def less_than_or_equal_to(value)
  IntervalSet.new_unsafe( [BasicIntervals::OpenClosedInterval.new(-Float::INFINITY, value)] )
end

.open_closed(from, to) ⇒ Object



88
89
90
# File 'lib/interval_notation.rb', line 88

def open_closed(from, to)
  IntervalSet.new_unsafe( [BasicIntervals::OpenClosedInterval.new(from, to)] )
end

.open_open(from, to) ⇒ Object



80
81
82
# File 'lib/interval_notation.rb', line 80

def open_open(from, to)
  IntervalSet.new_unsafe( [BasicIntervals::OpenOpenInterval.new(from, to)] )
end

.point(value) ⇒ Object



100
101
102
# File 'lib/interval_notation.rb', line 100

def point(value)
  IntervalSet.new_unsafe( [BasicIntervals::Point.new(value)] )
end