Class: String
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.random(length = 12, set = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') ⇒ Object
8 9 10 11 12 |
# File 'lib/slab/string.rb', line 8 def self.random(length = 12, set = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') set_size, string = set.size, '' length.times { string << set[SecureRandom.random_number(set_size)] } string end |
Instance Method Details
#to_iso ⇒ Object
4 5 6 |
# File 'lib/slab/string.rb', line 4 def to_iso encode('iso-8859-1', :invalid => :replace, :undef => :replace) end |