ruby - Creating this array programmatically? -


i'm populating simple array so:

queues = %w(rate_limit_000 rate_limit_001 rate_limit_002 rate_limit_003 rate_limit_004 rate_limit_005 rate_limit_006 rate_limit_007 rate_limit_008 rate_limit_009 rate_limit_010 rate_limit_011 rate_limit_012) 

that's ripe refactoring. what's easiest way build array without manually adding items?

the difference between item names last 3 digits, should 3 digits, need set limit on how high goes.

what using string#%?

(0..12).map { |i| "rate_limit_%03d" % } # => ["rate_limit_000", "rate_limit_001", "rate_limit_002", ... 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -