Class: CryptoList
- Inherits:
-
Object
- Object
- CryptoList
- Includes:
- CryptoCalculator::InstanceMethods, FancyText::InstanceMethods
- Defined in:
- lib/app/crypto_list.rb
Instance Attribute Summary collapse
-
#crypto_list ⇒ Object
Returns the value of attribute crypto_list.
-
#future_crypto_list ⇒ Object
Returns the value of attribute future_crypto_list.
Instance Method Summary collapse
-
#initialize(crypto_list = nil, future_crypto_list = nil) ⇒ CryptoList
constructor
A new instance of CryptoList.
- #list_future_data ⇒ Object
- #list_past_data ⇒ Object
- #set_player_crypto_list_on_future ⇒ Object
- #set_player_crypto_list_on_past ⇒ Object
- #show_list_iterator(list_crypto) ⇒ Object
Constructor Details
#initialize(crypto_list = nil, future_crypto_list = nil) ⇒ CryptoList
Returns a new instance of CryptoList.
14 15 16 17 |
# File 'lib/app/crypto_list.rb', line 14 def initialize crypto_list=nil, future_crypto_list=nil @crypto_list = CRYPTO_LIST @future_crypto_list = CRYPTO_LIST end |
Instance Attribute Details
#crypto_list ⇒ Object
Returns the value of attribute crypto_list.
11 12 13 |
# File 'lib/app/crypto_list.rb', line 11 def crypto_list @crypto_list end |
#future_crypto_list ⇒ Object
Returns the value of attribute future_crypto_list.
11 12 13 |
# File 'lib/app/crypto_list.rb', line 11 def future_crypto_list @future_crypto_list end |
Instance Method Details
#list_future_data ⇒ Object
50 51 52 53 54 55 |
# File 'lib/app/crypto_list.rb', line 50 def list_future_data get_rate(@future_crypto_list, Player.all[0].exit_date) set_player_crypto_list_on_future show_list_iterator(@future_crypto_list) end |
#list_past_data ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/app/crypto_list.rb', line 36 def list_past_data get_rate(@crypto_list, Player.all[0].entry_date) set_player_crypto_list_on_past ( "Fetching currencies and their rates [:bar]", " Successfully Fetched!! " ) show_list_iterator(@crypto_list) end |
#set_player_crypto_list_on_future ⇒ Object
23 24 25 |
# File 'lib/app/crypto_list.rb', line 23 def set_player_crypto_list_on_future Player.all[0].exited_crypto_data = @future_crypto_list end |
#set_player_crypto_list_on_past ⇒ Object
19 20 21 |
# File 'lib/app/crypto_list.rb', line 19 def set_player_crypto_list_on_past Player.all[0].past_crypto_list = @crypto_list end |
#show_list_iterator(list_crypto) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/app/crypto_list.rb', line 27 def show_list_iterator(list_crypto) pastel = Pastel.new list_crypto.each.with_index(1) do |crypto, index| puts pastel.green.bold(" #{index}. #{crypto[0].upcase} - #{crypto[1]} - #{crypto[2]} AUD ") end end |