From c81e3d739984aee67c7a7fda319d9440d7b60753 Mon Sep 17 00:00:00 2001 From: Alexander Munch-Hansen Date: Thu, 17 Oct 2019 11:34:45 +0200 Subject: [PATCH] More beautify --- lol.rb | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/lol.rb b/lol.rb index 7fafc78..0739142 100644 --- a/lol.rb +++ b/lol.rb @@ -38,9 +38,7 @@ def construct_class(name_of_class, parameters, to_string_template, sorting_filte end (0...parameters.length).each do |x| - pls = '" + ' - pls += parameters[x][:name] - pls += '+ "' + pls = "\" + #{parameters[x][:name]} + \"" to_string_template.sub! "#{x}", pls end @@ -70,18 +68,10 @@ end def construct_driver(class_name, parameters, methods, container_class, container_params) def args(parameters) - tmp = parameters.map do |x| + parameters.map do |x| type = x[:type] - - res_string = "" - if type == "int" - res_string += "#{rand(max=100)}" - else - res_string += '"' + (0...10).map { ('a'..'z').to_a[rand(26)] }.join + '"' - end - res_string - end - tmp.join "," + type == "int" ? "#{rand(max=100)}" : "\"#{(0...10).map { ('a'..'z').to_a[rand(26)] }.join}\"" + end.join "," end