lib/procemon/mpatch/random.rb in procemon-0.0.8 vs lib/procemon/mpatch/random.rb in procemon-0.0.9

- old
+ new

@@ -1,18 +1,15 @@ class RND class << self - def string(length= 7,amount=1) - mrg = String.new - first_string = true + def string(length= 7,amount=1,hyphen= " ") + amount_container= Array.new amount.times do - a_string = Random.rand(length) - a_string == 0 ? a_string += 1 : a_string - mrg_prt = (0...a_string).map{ ('a'..'z').to_a[rand(26)] }.join - first_string ? mrg += mrg_prt : mrg+= " " + "#{mrg_prt}" - first_string = false + mrg= String.new + mrg= (0...length).map{ ('a'..'z').to_a[rand(26)] }.join + amount_container.push mrg end - return mrg + return amount_container.join(hyphen) end def integer(length= 3) Random.rand(length) end def boolean @@ -27,10 +24,9 @@ def datetime from = Time.at(1114924812), to = Time.now rand(from..to).to_datetime end end end - # alias in Random from RND begin (RND.singleton_methods-Object.singleton_methods).each do |one_method_sym| Random.class_eval do