Module: Qotd
- Defined in:
- lib/qotd.rb,
lib/qotd/version.rb
Constant Summary collapse
- VERSION =
"2.0.3"
- GEMDIR =
"/Library/Ruby/Gems/2.0.0/Gems/qotd-#{Qotd::VERSION}"
Class Method Summary collapse
- .clear ⇒ Object
- .color ⇒ Object
- .quote ⇒ Object
- .quote_file ⇒ Object
- .quotes ⇒ Object
- .rand_index ⇒ Object
Class Method Details
.clear ⇒ Object
27 28 29 |
# File 'lib/qotd.rb', line 27 def self.clear "\033[0m" # => Reset to normal. end |
.color ⇒ Object
23 24 25 |
# File 'lib/qotd.rb', line 23 def self.color "\033[7m" # => Colored background. end |
.quote ⇒ Object
19 20 21 |
# File 'lib/qotd.rb', line 19 def self.quote quotes[self.rand_index] # => A random quote. end |
.quote_file ⇒ Object
6 7 8 9 |
# File 'lib/qotd.rb', line 6 def self.quote_file file = File.join(File.dirname(__FILE__), "quotes/quotes.txt") File.read(file) # => A string of the quotes from the file. end |
.quotes ⇒ Object
11 12 13 |
# File 'lib/qotd.rb', line 11 def self.quotes quote_file.split(/\n\n/) # => Individual quotes in an array. end |
.rand_index ⇒ Object
15 16 17 |
# File 'lib/qotd.rb', line 15 def self.rand_index rand(quotes.length) # => A random index of quotes array. end |