Class: DevCli

Inherits:
Cli
  • Object
show all
Defined in:
lib/dev_cli.rb

Instance Attribute Summary collapse

Attributes inherited from Cli

#scraper, #stock

Instance Method Summary collapse

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

#mainObject

Returns the value of attribute main.



3
4
5
# File 'lib/dev_cli.rb', line 3

def main
  @main
end

Instance Method Details

#option_menuObject



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 option_menu
	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.expand_path(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 stock_option_menu(opt_1_string, opt_1_lambda)
	input = super(opt_1_string, opt_1_lambda)
	if input == "1"
		opt_1_lambda.()
	elsif input == "2"
		self.option_menu
	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 ""
		option_menu
	end
	valid_array[0] # returns whether entered symbol was valid
end