Class: Tulipmania::Configuration
- Inherits:
-
Object
- Object
- Tulipmania::Configuration
- Defined in:
- lib/tulipmania.rb
Constant Summary collapse
- WALLET_ADDRESSES =
['Anne', 'Vicent', 'Ruben', 'Julia', 'Luuk', 'Daisy', 'Max', 'Martijn', 'Naomi', 'Mina', 'Isabel' ]
- TULIP_GROWERS =
note: add a (†) coinbase / grower marker
['Dutchgrown†', 'Keukenhof†', 'Flowers†', 'Bloom & Blossom†', 'Teleflora†' ]
- TULIPS =
['Semper Augustus', 'Admiral van Eijck', 'Admiral of Admirals', 'Red Impression', 'Bloemendaal Sunset', ]
Instance Attribute Summary collapse
-
#address ⇒ Object
user/node settings.
-
#coinbase ⇒ Object
system/blockchain settings.
-
#mining_reward ⇒ Object
Returns the value of attribute mining_reward.
-
#tulips ⇒ Object
rename to assets/commodities/etc.
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
- #rand_tulip ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/tulipmania.rb', line 64 def initialize ## try default setup via ENV variables ## pick "random" address if nil (none passed in) @address = ENV[ 'TULIPMANIA_NAME'] || rand_address() @coinbase = TULIP_GROWERS ## use a different name for coinbase - why? why not? ## note: for now is an array (multiple growsers) @tulips = TULIPS ## change name to commodities or assets - why? why not? @mining_reward = 5 end |
Instance Attribute Details
#address ⇒ Object
user/node settings
40 41 42 |
# File 'lib/tulipmania.rb', line 40 def address @address end |
#coinbase ⇒ Object
system/blockchain settings
48 49 50 |
# File 'lib/tulipmania.rb', line 48 def coinbase @coinbase end |
#mining_reward ⇒ Object
Returns the value of attribute mining_reward.
49 50 51 |
# File 'lib/tulipmania.rb', line 49 def mining_reward @mining_reward end |
#tulips ⇒ Object
rename to assets/commodities/etc. - why? why not?
50 51 52 |
# File 'lib/tulipmania.rb', line 50 def tulips @tulips end |
Instance Method Details
#coinbase?(address) ⇒ Boolean
check/todo: use wallet - why? why not? (for now wallet==address)
81 82 83 |
# File 'lib/tulipmania.rb', line 81 def coinbase?( address ) ## check/todo: use wallet - why? why not? (for now wallet==address) @coinbase.include?( address ) end |
#rand_address ⇒ Object
77 |
# File 'lib/tulipmania.rb', line 77 def rand_address() WALLET_ADDRESSES[rand( WALLET_ADDRESSES.size )]; end |
#rand_coinbase ⇒ Object
79 |
# File 'lib/tulipmania.rb', line 79 def rand_coinbase() @coinbase[rand( @coinbase.size )]; end |
#rand_tulip ⇒ Object
78 |
# File 'lib/tulipmania.rb', line 78 def rand_tulip() @tulips[rand( @tulips.size )]; end |