Class: QuickTicker::MainCli
Instance Attribute Summary collapse
-
#dev ⇒ Object
Returns the value of attribute dev.
Attributes inherited from Cli
#exit_message, #last_option_lambda, #scraper, #stock
Instance Method Summary collapse
-
#initialize(cli = nil) ⇒ MainCli
constructor
A new instance of MainCli.
- #symbol_validation(symbol, fixture_url = nil) ⇒ Object
- #ticker_symbol_prompt ⇒ Object
Methods inherited from Cli
#call_stock_option_menu, #display_stock_description, #display_stock_header, #display_stock_option_menu, #display_stock_quote, #display_stock_related_companies, #fetch_stock_description, #fetch_stock_quote, #fetch_stock_related_companies, #process_stock_option_menu_input, #welcome
Constructor Details
#initialize(cli = nil) ⇒ MainCli
Returns a new instance of MainCli.
7 8 9 10 11 12 |
# File 'lib/main_cli.rb', line 7 def initialize(cli = nil) super(cli) self.dev = QuickTicker::DevCli.new(self) self.last_option_lambda = -> { self.ticker_symbol_prompt } self. = "Thank you for using Quick Ticker!" end |
Instance Attribute Details
#dev ⇒ Object
Returns the value of attribute dev.
5 6 7 |
# File 'lib/main_cli.rb', line 5 def dev @dev end |
Instance Method Details
#symbol_validation(symbol, fixture_url = nil) ⇒ Object
28 29 30 |
# File 'lib/main_cli.rb', line 28 def symbol_validation(symbol, fixture_url = nil) super(symbol)[0] # returns whether entered symbol was valid end |
#ticker_symbol_prompt ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/main_cli.rb', line 15 def ticker_symbol_prompt valid = false while !valid do print "\nPlease enter a ticker symbol: " symbol = gets.strip.upcase if symbol == "DEV" self.dev.welcome("Developer Mode", -> {self.dev.}) if symbol == "DEV" else valid = self.symbol_validation(symbol) end end end |