Class: Centralbank::Configuration
- Inherits:
-
Object
- Object
- Centralbank::Configuration
- Defined in:
- lib/centralbank.rb
Constant Summary collapse
- WALLET_ADDRESSES =
%w[Alice Bob Max Franz Maria Ferdl Lisi Adam Eva]
- COINBASE =
note: add a (†) coinbase marker
['Everest†', 'Aconcagua†', 'Denali†', 'Kilimanjaro†', 'Elbrus†', 'Vinson†', 'Puncak Jaya†', 'Kosciuszko†', 'Mont Blanc†' ]
Instance Attribute Summary collapse
-
#address ⇒ Object
user/node settings.
-
#coinbase ⇒ Object
system/blockchain settings.
-
#mining_reward ⇒ Object
Returns the value of attribute mining_reward.
Instance Method Summary collapse
-
#coinbase?(address) ⇒ Boolean
check/todo: use wallet - why? why not? (for now wallet==address).
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #rand_address ⇒ Object
- #rand_coinbase ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
60 61 62 63 64 65 66 67 68 |
# File 'lib/centralbank.rb', line 60 def initialize ## try default setup via ENV variables ## pick "random" address if nil (none passed in) @address = ENV[ 'CENTRALBANK_NAME'] || rand_address() @coinbase = COINBASE ## use a different name - why? why not? ## note: for now is an array (multiple coinbases) @mining_reward = 5 end |
Instance Attribute Details
#address ⇒ Object
user/node settings
44 45 46 |
# File 'lib/centralbank.rb', line 44 def address @address end |
#coinbase ⇒ Object
system/blockchain settings
49 50 51 |
# File 'lib/centralbank.rb', line 49 def coinbase @coinbase end |
#mining_reward ⇒ Object
Returns the value of attribute mining_reward.
50 51 52 |
# File 'lib/centralbank.rb', line 50 def mining_reward @mining_reward end |
Instance Method Details
#coinbase?(address) ⇒ Boolean
check/todo: use wallet - why? why not? (for now wallet==address)
73 74 75 |
# File 'lib/centralbank.rb', line 73 def coinbase?( address ) ## check/todo: use wallet - why? why not? (for now wallet==address) @coinbase.include?( address ) end |
#rand_address ⇒ Object
70 |
# File 'lib/centralbank.rb', line 70 def rand_address() WALLET_ADDRESSES[rand( WALLET_ADDRESSES.size )]; end |
#rand_coinbase ⇒ Object
71 |
# File 'lib/centralbank.rb', line 71 def rand_coinbase() @coinbase[rand( @coinbase.size )]; end |