Module: StringUtility
Class Method Summary collapse
-
.random_color_six ⇒ String
Gets a random six-digit hexidecimal web color string.
-
.random_color_three ⇒ String
Gets a random three-digit hexidecimal 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 hexidecimal web color string.
66 67 68 69 |
# File 'lib/utils.rb', line 66 def self.random_color_six string = random_color(0..5) "##{string}" end |
.random_color_three ⇒ String
Gets a random three-digit hexidecimal web color string.
59 60 61 62 |
# File 'lib/utils.rb', line 59 def self.random_color_three string = random_color(0..2) "##{string}" end |
.random_line(path) ⇒ String
Gets a random line in a file.
52 53 54 55 |
# File 'lib/utils.rb', line 52 def self.random_line(path) read = File.readlines(path) read[rand(read.size)].chomp end |