Class: Numeric

Inherits:
Object show all
Defined in:
lib/alib-0.5.1/stdext.rb

Instance Method Summary collapse

Instance Method Details

#daysObject



36
# File 'lib/alib-0.5.1/stdext.rb', line 36

def days() 24 * hours end

#decadesObject



40
# File 'lib/alib-0.5.1/stdext.rb', line 40

def decades() 10 * years end

#hoursObject



35
# File 'lib/alib-0.5.1/stdext.rb', line 35

def hours() 60 * minutes end

#microsecondsObject



31
# File 'lib/alib-0.5.1/stdext.rb', line 31

def microseconds() Float(self  * (10 ** -6)) end

#millisecondsObject



32
# File 'lib/alib-0.5.1/stdext.rb', line 32

def milliseconds() Float(self  * (10 ** -3)) end

#minutesObject



34
# File 'lib/alib-0.5.1/stdext.rb', line 34

def minutes() 60 * seconds end

#monthsObject



38
# File 'lib/alib-0.5.1/stdext.rb', line 38

def months() 30 * days end

#of(head = nil, *tail, &b) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/alib-0.5.1/stdext.rb', line 21

def of head = nil, *tail, &b
#--{{{
  if head
    a = tail.empty? ? head : [head]+tail
    b = lambda{ a }
  end
  Array.new(self).map &b
#--}}}
end

#secondsObject



33
# File 'lib/alib-0.5.1/stdext.rb', line 33

def seconds() self end

#weeksObject



37
# File 'lib/alib-0.5.1/stdext.rb', line 37

def weeks() 7 * days end

#yearsObject



39
# File 'lib/alib-0.5.1/stdext.rb', line 39

def years() 365 * days end