Class: MainCli
Instance Attribute Summary collapse
-
#dev ⇒ Object
Returns the value of attribute dev.
-
#scraper ⇒ Object
Returns the value of attribute scraper.
Attributes inherited from Cli
Instance Method Summary collapse
-
#initialize(cli = nil) ⇒ MainCli
constructor
A new instance of MainCli.
- #stock_option_menu(opt_1_string, opt_1_lambda) ⇒ Object
- #symbol_validation(symbol, valid, fixture_url = nil) ⇒ Object
- #ticker_symbol_prompt ⇒ Object
Methods inherited from Cli
#display_desc, #display_quote, #welcome
Constructor Details
#initialize(cli = nil) ⇒ MainCli
Returns a new instance of MainCli.
5 6 7 8 |
# File 'lib/main_cli.rb', line 5 def initialize(cli = nil) super(cli) self.dev = DevCli.new(self) end |
Instance Attribute Details
#dev ⇒ Object
Returns the value of attribute dev.
3 4 5 |
# File 'lib/main_cli.rb', line 3 def dev @dev end |
#scraper ⇒ Object
Returns the value of attribute scraper.
3 4 5 |
# File 'lib/main_cli.rb', line 3 def scraper @scraper end |
Instance Method Details
#stock_option_menu(opt_1_string, opt_1_lambda) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/main_cli.rb', line 24 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.ticker_symbol_prompt else return nil end end |
#symbol_validation(symbol, valid, fixture_url = nil) ⇒ Object
35 36 37 |
# File 'lib/main_cli.rb', line 35 def symbol_validation(symbol, valid, fixture_url = nil) super(symbol, valid)[0] # returns whether entered symbol was valid end |
#ticker_symbol_prompt ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/main_cli.rb', line 11 def ticker_symbol_prompt valid = false while !valid do print "\nPlease enter a ticker symbol: " symbol = gets.strip.upcase if symbol == "DEV" self.welcome("Developer Mode", -> {self.dev.}) if symbol == "DEV" else valid = self.symbol_validation(symbol, valid) end end end |