Class: String

Inherits:
Object show all
Defined in:
lib/graphviz/core_ext.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.random(size) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/graphviz/core_ext.rb', line 2

def self.random(size)
   s = ""
   d = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
   size.times {
      s << d[rand(d.size)]
   }
   return s
end

Instance Method Details

#convert_base(from, to) ⇒ Object



11
12
13
# File 'lib/graphviz/core_ext.rb', line 11

def convert_base(from, to)
   self.to_i(from).to_s(to)
end