How to optimize 'string.split("&").sort.join("&")' using Ruby on Rails? -


i using ruby on rails 3 , in code have this:

string = "surname=testsurname&name=testname" string.split("&").sort.join("&")  # 'string' value "name=testname&surname=testsurname" 

there better way that?

if better mean faster, not. that's straightforward implementation of you're intending do. how calling method? context being called in? optimize @ ways avoid performing operation more times strictly required.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -