Class: Integer

Inherits:
Object
  • Object
show all
Defined in:
lib/universum/type.rb,
lib/universum/units_time.rb,
lib/universum/units_money.rb

Overview

add dummy bool class for mapping and (payable) method signature

Constant Summary collapse

HOUR_IN_SECONDS =

note: there’s NO month (for now)!!!

why?  month might be 28,29,30,31  days
 use days e.g. 30.days or 31.days etc.
60 * 60
DAY_IN_SECONDS =

60 minutes * 60 seconds

24 * HOUR_IN_SECONDS
WEEK_IN_SECONDS =

24 hours * 60 * 60

7 * DAY_IN_SECONDS
FORTNIGHT_IN_SECONDS =

7 days * 24 * 60 * 60

14 * DAY_IN_SECONDS
YEAR_IN_SECONDS =

14 days * 24 * 60 * 60

365 * DAY_IN_SECONDS
E3 =

1_000

10**3
E6 =

1_000_000

10**6
E9 =

1_000_000_000

10**9
E12 =

1_000_000_000_000

10**12
E15 =

1_000_000_000_000_000

10**15
E18 =

1_000_000_000_000_000_000

10**18

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.zeroObject



7
# File 'lib/universum/type.rb', line 7

def self.zero() 0; end

Instance Method Details

#adaObject

todo/check: in use, really? keep just lovelave- why? why not?



53
# File 'lib/universum/units_money.rb', line 53

def ada()       mwei; end

#babbageObject

alias - use alias or alias_method - why? why not?



51
# File 'lib/universum/units_money.rb', line 51

def babbage()   kwei; end

#dObject



41
# File 'lib/universum/units_time.rb', line 41

def d()    day; end

#dayObject



20
# File 'lib/universum/units_time.rb', line 20

def day()       self * DAY_IN_SECONDS;  end

#daysObject



40
# File 'lib/universum/units_time.rb', line 40

def days() day; end

#e12Object



15
# File 'lib/universum/units_money.rb', line 15

def e12() self * E12; end

#e15Object



16
# File 'lib/universum/units_money.rb', line 16

def e15() self * E15; end

#e18Object



17
# File 'lib/universum/units_money.rb', line 17

def e18() self * E18; end

#e3Object



12
# File 'lib/universum/units_money.rb', line 12

def e3()  self * E3; end

#e6Object



13
# File 'lib/universum/units_money.rb', line 13

def e6()  self * E6; end

#e9Object



14
# File 'lib/universum/units_money.rb', line 14

def e9()  self * E9; end

#ethObject



62
# File 'lib/universum/units_money.rb', line 62

def eth()       ether; end

#etherObject



47
# File 'lib/universum/units_money.rb', line 47

def ether()      self * E18; end

#finneyObject



56
# File 'lib/universum/units_money.rb', line 56

def finney()    milliether; end

#fortnightObject



22
# File 'lib/universum/units_time.rb', line 22

def fortnight() self * FORTNIGHT_IN_SECONDS; end

#fortnightsObject



46
# File 'lib/universum/units_time.rb', line 46

def fortnights() fortnight; end

#gweiObject



44
# File 'lib/universum/units_money.rb', line 44

def gwei()       self * E9; end

#hObject



38
# File 'lib/universum/units_time.rb', line 38

def h()       hour; end

#hourObject



19
# File 'lib/universum/units_time.rb', line 19

def hour()      self * HOUR_IN_SECONDS; end

#hoursObject



37
# File 'lib/universum/units_time.rb', line 37

def hours()   hour; end

#kweiObject



42
# File 'lib/universum/units_money.rb', line 42

def kwei()       self * E3; end

#lovelaceObject



52
# File 'lib/universum/units_money.rb', line 52

def lovelace()  mwei; end

#mObject



35
# File 'lib/universum/units_time.rb', line 35

def m()       minute; end

#microObject



59
# File 'lib/universum/units_money.rb', line 59

def micro()     microether; end

#microethObject



58
# File 'lib/universum/units_money.rb', line 58

def microeth()  microether; end

#microetherObject



45
# File 'lib/universum/units_money.rb', line 45

def microether() self * E12; end

#milliObject



61
# File 'lib/universum/units_money.rb', line 61

def milli()     milliether; end

#milliethObject



60
# File 'lib/universum/units_money.rb', line 60

def millieth()  milliether; end

#millietherObject



46
# File 'lib/universum/units_money.rb', line 46

def milliether() self * E15; end

#minObject



34
# File 'lib/universum/units_time.rb', line 34

def min()     minute; end

#minsObject



33
# File 'lib/universum/units_time.rb', line 33

def mins()    minute; end

#minuteObject



18
# File 'lib/universum/units_time.rb', line 18

def minute()    self * 60; end

#minutesObject



32
# File 'lib/universum/units_time.rb', line 32

def minutes() minute; end

#mweiObject



43
# File 'lib/universum/units_money.rb', line 43

def mwei()       self * E6; end

#sObject



30
# File 'lib/universum/units_time.rb', line 30

def s()       second; end

#secObject



29
# File 'lib/universum/units_time.rb', line 29

def sec()     second; end

#secondObject

365 days * 24 * 60 * 60



17
# File 'lib/universum/units_time.rb', line 17

def second()    self; end

#secondsObject

alias - use alias or alias_method - why? why not?



27
# File 'lib/universum/units_time.rb', line 27

def seconds() second; end

#secsObject



28
# File 'lib/universum/units_time.rb', line 28

def secs()    second; end

#shannonObject



54
# File 'lib/universum/units_money.rb', line 54

def shannon()   gwei; end

#szaboObject



55
# File 'lib/universum/units_money.rb', line 55

def szabo()     microether; end

#wObject



44
# File 'lib/universum/units_time.rb', line 44

def w()     week; end

#weekObject



21
# File 'lib/universum/units_time.rb', line 21

def week()      self * WEEK_IN_SECONDS; end

#weeksObject



43
# File 'lib/universum/units_time.rb', line 43

def weeks() week; end

#weiObject

Ethereum money units

wei                     1 wei | 1
kwei (babbage)        1e3 wei | 1_000
mwei (lovelace | ada) 1e6 wei | 1_000_000
gwei (shannon)        1e9 wei | 1_000_000_000
microether (szabo)   1e12 wei | 1_000_000_000_000
milliether (finney)  1e15 wei | 1_000_000_000_000_000
ether                1e18 wei | 1_000_000_000_000_000_000

Names in Honor:
 wei            => Wei Dai
 lovelace | ada => Ada Lovelace (1815-1852)
 babbage	       => Charles Babbage (1791-1871)
 shannon	       => Claude Shannon (1916-2001)
 szabo          => Nick Szabo
 finney         => Hal Finney (1956-2014)


41
# File 'lib/universum/units_money.rb', line 41

def wei()        self; end

#yObject



49
# File 'lib/universum/units_time.rb', line 49

def y()     year; end

#yearObject



23
# File 'lib/universum/units_time.rb', line 23

def year()      self * YEAR_IN_SECONDS; end

#yearsObject



48
# File 'lib/universum/units_time.rb', line 48

def years() year; end