Class: TimeScales::Units::AbstractUnit
- Inherits:
-
Object
- Object
- TimeScales::Units::AbstractUnit
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
|
#name ⇒ Object
25
26
27
|
# File 'lib/time_scales/units.rb', line 25
def name
@name ||= /::([^:]+)Class$/.match( self.class.name )[1]
end
|
#scale ⇒ Object
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.
21
22
23
|
# File 'lib/time_scales/units.rb', line 21
def scale
raise NotImplementedError, "Subclass responsibility"
end
|
#symbol ⇒ Object
14
15
16
|
# File 'lib/time_scales/units.rb', line 14
def symbol
raise NotImplementedError, "Subclass responsibility"
end
|
#to_time_scales_unit ⇒ Object
6
7
8
|
# File 'lib/time_scales/units.rb', line 6
def to_time_scales_unit
self
end
|