Class: QuoteImporter

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/quote_importer.rb

Instance Method Summary collapse

Constructor Details

#initializeQuoteImporter

Returns a new instance of QuoteImporter.



2
3
4
5
6
7
8
9
10
# File 'lib/rack/quote_importer.rb', line 2

def initialize
	@quotes = []
	Dir.glob('fixtures/*.txt').each do |file|
		f = File.open(file)
		f.each_line do |line|
			@quotes << line.chomp
		end
	end
end

Instance Method Details

#randomObject



12
13
14
# File 'lib/rack/quote_importer.rb', line 12

def random
	@quotes.shuffle.first
end