Class: DevCli
Instance Attribute Summary collapse
-
#main ⇒ Object
Returns the value of attribute main.
Attributes inherited from Cli
Instance Method Summary collapse
-
#initialize(main_cli) ⇒ DevCli
constructor
A new instance of DevCli.
- #option_menu ⇒ Object
- #stock_option_menu(opt_1_string, opt_1_lambda) ⇒ Object
- #symbol_validation(symbol, valid, fixture_url = nil) ⇒ Object
Methods inherited from Cli
#display_desc, #display_quote, #welcome
Constructor Details
#initialize(main_cli) ⇒ DevCli
Returns a new instance of DevCli.
5 6 7 8 |
# File 'lib/dev_cli.rb', line 5 def initialize(main_cli) super(main_cli) self.main = main_cli end |
Instance Attribute Details
#main ⇒ Object
Returns the value of attribute main.
3 4 5 |
# File 'lib/dev_cli.rb', line 3 def main @main end |
Instance Method Details
#option_menu ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/dev_cli.rb', line 10 def puts "\nPlease select a fixture to load:" puts "1. Load MSFT.html" puts "2. Load IBM.html" puts "3. Load QQQ.html" puts "4. Load FBIOX.html" puts "Or enter any other key to return to" puts "your regularly scheduled program." input = gets.strip.gsub('.', '') path = File.(File.dirname(__FILE__)).chomp('bin') + '/fixtures/' if input == "1" valid = self.symbol_validation("MSFT", false, path + "MSFT.html") elsif input == "2" valid = self.symbol_validation("IBM", false, path + "IBM.html") elsif input == "3" valid = self.symbol_validation("QQQ", false, path + "QQQ.html") elsif input == "4" valid = self.symbol_validation("FBIOX", false, path + "FBIOX.html") else puts "Leaving Developer Mode and resuming program." end return nil end |
#stock_option_menu(opt_1_string, opt_1_lambda) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/dev_cli.rb', line 34 def (opt_1_string, opt_1_lambda) input = super(opt_1_string, opt_1_lambda) if input == "1" opt_1_lambda.() elsif input == "2" self. else puts "Leaving Developer Mode and resuming program." return nil end end |
#symbol_validation(symbol, valid, fixture_url = nil) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/dev_cli.rb', line 46 def symbol_validation(symbol, valid, fixture_url = nil) valid_array = super(symbol, valid, fixture_url) if valid_array[1] # whether entered symbol was a mutual fund puts "" end valid_array[0] # returns whether entered symbol was valid end |