Class: TimeFrame::Empty

Inherits:
TimeFrame show all
Includes:
Singleton
Defined in:
lib/time_frame/empty.rb

Overview

Singleton class for the empty time frame object

Constant Summary

Constants inherited from TimeFrame

EMPTY, VERSION

Instance Attribute Summary

Attributes inherited from TimeFrame

#max, #min

Instance Method Summary collapse

Methods inherited from TimeFrame

#<=>, #==, #after?, #before?, covering_time_frame_for, each_overlap, #hash, #initialize, intersection, union

Constructor Details

This class inherits a constructor from TimeFrame

Instance Method Details

#&(_other) ⇒ Object



22
23
24
# File 'lib/time_frame/empty.rb', line 22

def &(_other)
  self
end

#cover?(element) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/time_frame/empty.rb', line 10

def cover?(element)
  element == EMPTY
end

#durationObject



6
7
8
# File 'lib/time_frame/empty.rb', line 6

def duration
  0
end

#empty?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/time_frame/empty.rb', line 14

def empty?
  true
end

#inspectObject



46
47
48
# File 'lib/time_frame/empty.rb', line 46

def inspect
  'EMPTY'
end

#overlaps?(_) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/time_frame/empty.rb', line 26

def overlaps?(_)
  false
end

#shift_by(_) ⇒ Object



34
35
36
# File 'lib/time_frame/empty.rb', line 34

def shift_by(_)
  fail TypeError, 'can\'t shift empty time frame'
end

#shift_to(_) ⇒ Object



38
39
40
# File 'lib/time_frame/empty.rb', line 38

def shift_to(_)
  fail TypeError, 'can\'t shift empty time frame'
end

#split_by_interval(_) ⇒ Object



30
31
32
# File 'lib/time_frame/empty.rb', line 30

def split_by_interval(_)
  []
end

#time_between(_) ⇒ Object



18
19
20
# File 'lib/time_frame/empty.rb', line 18

def time_between(_)
  fail TypeError, 'time_between is undefined for empty time frame'
end

#without(*_) ⇒ Object



42
43
44
# File 'lib/time_frame/empty.rb', line 42

def without(*_)
  []
end