Class: Shilling::Configuration
- Inherits:
-
Object
- Object
- Shilling::Configuration
- Defined in:
- lib/shilling.rb
Constant Summary collapse
- WALLET_ADDRESSES =
%w[Theresa Franz Antonia Maximilan Maria Ferdinand Elisabeth Adam Eva]
- COINBASE =
note: add a (†) coinbase marker
fix: "sync" with ledger-lite config!!!!
['Coinbase†']
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.
76 77 78 79 80 81 82 83 84 |
# File 'lib/shilling.rb', line 76 def initialize ## try default setup via ENV variables ## pick "random" address if nil (none passed in) @address = ENV[ 'SHILLING_NAME'] || rand_address() @coinbase = COINBASE ## use a different name - why? why not? ## note: for now is an array (multiple coinbases) @mining_reward = 43 ## use country code for austria (43) end |
Instance Attribute Details
#address ⇒ Object
user/node settings
56 57 58 |
# File 'lib/shilling.rb', line 56 def address @address end |
#coinbase ⇒ Object
system/blockchain settings
61 62 63 |
# File 'lib/shilling.rb', line 61 def coinbase @coinbase end |
#mining_reward ⇒ Object
Returns the value of attribute mining_reward.
62 63 64 |
# File 'lib/shilling.rb', line 62 def mining_reward @mining_reward end |
Instance Method Details
#coinbase?(address) ⇒ Boolean
check/todo: use wallet - why? why not? (for now wallet==address)
89 90 91 |
# File 'lib/shilling.rb', line 89 def coinbase?( address ) ## check/todo: use wallet - why? why not? (for now wallet==address) @coinbase.include?( address ) end |
#rand_address ⇒ Object
86 |
# File 'lib/shilling.rb', line 86 def rand_address() WALLET_ADDRESSES[rand( WALLET_ADDRESSES.size )]; end |
#rand_coinbase ⇒ Object
87 |
# File 'lib/shilling.rb', line 87 def rand_coinbase() @coinbase[rand( @coinbase.size )]; end |