Class: TimeScales::Units::AbstractUnit

Inherits:
Object
  • Object
show all
Defined in:
lib/time_scales/units.rb

Instance Method Summary collapse

Instance Method Details

#===(other) ⇒ Object



10
11
12
# File 'lib/time_scales/units.rb', line 10

def ===(other)
  self == other || symbol == other
end

#nameObject



25
26
27
# File 'lib/time_scales/units.rb', line 25

def name
  @name ||= /::([^:]+)Class$/.match( self.class.name )[1]
end

#scaleObject

Rough order of magnitude of subdivision unit size. 1.407 times the base-2 logarithm of approximate number of seconds per unit, then round to nearest integer.

Raises:

  • (NotImplementedError)


21
22
23
# File 'lib/time_scales/units.rb', line 21

def scale
  raise NotImplementedError, "Subclass responsibility"
end

#symbolObject

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/time_scales/units.rb', line 14

def symbol
  raise NotImplementedError, "Subclass responsibility"
end

#to_time_scales_unitObject



6
7
8
# File 'lib/time_scales/units.rb', line 6

def to_time_scales_unit
  self
end