Class: Account
Constant Summary collapse
- @@directory =
{}
Instance Attribute Summary collapse
-
#tx ⇒ Object
readonly
Returns the value of attribute tx.
Class Method Summary collapse
- .[](key) ⇒ Object
- .all ⇒ Object
-
.at(key) ⇒ Object
another “classic” alias for find_by_address.
-
.find(key) ⇒ Object
make find_by_address the default finder.
- .find_by_address(key) ⇒ Object
Instance Method Summary collapse
-
#_auto_inc_tx ⇒ Object
“internal” method - (auto) increment transaction (tx) counter.
-
#balance=(value) ⇒ Object
note: for now allow write access too!!!.
-
#this ⇒ Object
note: needed by transfer/send.
Methods included from Address
#_add, #_sub, #address, #balance, #send, #transfer, zero
Instance Attribute Details
#tx ⇒ Object (readonly)
Returns the value of attribute tx.
172 173 174 |
# File 'lib/universum/universum.rb', line 172 def tx @tx end |
Class Method Details
.[](key) ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/universum/universum.rb', line 148 def self.[]( key ) o = find_by_address( key ) if o o else o = new( key ) ## note: auto-register (new) address in (yellow page) directory @@directory[ key ] = o o end end |
.all ⇒ Object
160 |
# File 'lib/universum/universum.rb', line 160 def self.all() @@directory.values; end |
.at(key) ⇒ Object
another “classic” alias for find_by_address
146 |
# File 'lib/universum/universum.rb', line 146 def self.at( key) find_by_address( key ); end |
.find(key) ⇒ Object
make find_by_address the default finder
145 |
# File 'lib/universum/universum.rb', line 145 def self.find( key ) find_by_address( key ); end |
.find_by_address(key) ⇒ Object
140 141 142 143 144 |
# File 'lib/universum/universum.rb', line 140 def self.find_by_address( key ) ## clean key (allow "embedded" name e.g 0x1111 (Alice)) key = key.gsub(/\(.+\)/, '' ).strip @@directory[ key ] end |
Instance Method Details
#_auto_inc_tx ⇒ Object
“internal” method - (auto) increment transaction (tx) counter
173 |
# File 'lib/universum/universum.rb', line 173 def _auto_inc_tx() @tx += 1; end |
#balance=(value) ⇒ Object
note: for now allow write access too!!!
168 169 170 |
# File 'lib/universum/universum.rb', line 168 def balance=( value ) @balance = value end |