Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/straight-server/random_string.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.random(len) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/straight-server/random_string.rb', line 3 def self.random(len) s = "" while s.length != len do s = rand(36**len).to_s(36) end s end |
Instance Method Details
#repeat(times) ⇒ Object
11 12 13 14 15 |
# File 'lib/straight-server/random_string.rb', line 11 def repeat(times) result = "" times.times { result << self } result end |