Class: Daru::Offsets::Tick Abstract

Inherits:
DateOffsetType show all
Defined in:
lib/daru/date_time/offsets.rb

Overview

This class is abstract.

Private superclass for Offsets with equal inter-frequencies.

Direct Known Subclasses

Day, Hour, Minute, Month, Second, Year

Instance Method Summary collapse

Methods inherited from DateOffsetType

#freq_string, #initialize

Methods inherited from DateOffset

#-@, #initialize

Constructor Details

This class inherits a constructor from Daru::Offsets::DateOffsetType

Instance Method Details

#+(date_time) ⇒ Object



107
108
109
# File 'lib/daru/date_time/offsets.rb', line 107

def + date_time
  date_time + @n*multiplier
end

#-(date_time) ⇒ Object



111
112
113
# File 'lib/daru/date_time/offsets.rb', line 111

def - date_time
  date_time - @n*multiplier
end

#==(other_obj) ⇒ Object



115
116
117
# File 'lib/daru/date_time/offsets.rb', line 115

def ==(other_obj)
  other_obj.is_a?(Tick) && period == other_obj.period
end

#periodObject



119
120
121
# File 'lib/daru/date_time/offsets.rb', line 119

def period
  @n * multiplier
end