Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/kit/support/string.rb,
lib/text_utils/support.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.random(length = 3) ⇒ Object
11 12 13 14 |
# File 'lib/text_utils/support.rb', line 11 def self.random length = 3 @digits ||= ('a'..'z').to_a + (0..9).to_a (0..(length-1)).map{@digits[rand(@digits.size)]}.join end |
Instance Method Details
#to_url_with_escape ⇒ Object
2 3 4 |
# File 'lib/kit/support/string.rb', line 2 def to_url_with_escape to_url_without_escape.gsub /[^a-z0-9_-]/, '' end |