Module: StringUtility
Class Method Summary collapse
-
.random_color_six ⇒ String
Gets a random six-digit hexadecimal web color string.
-
.random_color_three ⇒ String
Gets a random three-digit hexadecimal web color string.
-
.random_line(path) ⇒ String
Gets a random line in a file.
Class Method Details
.random_color_six ⇒ String
Gets a random six-digit hexadecimal web color string.
62 63 64 |
# File 'lib/utils.rb', line 62 def self.random_color_six random_color(6) end |
.random_color_three ⇒ String
Gets a random three-digit hexadecimal web color string.
56 57 58 |
# File 'lib/utils.rb', line 56 def self.random_color_three random_color(3) end |
.random_line(path) ⇒ String
Gets a random line in a file. This will include newlines and similar characters, so you may want to chomp the result.
49 50 51 52 |
# File 'lib/utils.rb', line 49 def self.random_line(path) lines = File.readlines(path) lines[rand(lines.count)] end |