I have some Ruby code which takes dates on the command line in the format:
-d 20080101,20080201..20080229,20080301
I want to run for all da
Here suppose you want to store the hash as a system constant value and fetch it in any model. The hash key will be a range value.
hash_1 = {1..5 => 'a', 6..12 => 'b', 13..67 => 'c', 68..9999999 => 'd'}
Then create the system constant with value as hash_1.to_json. .to_json will convert your hash object to JSON object. Now inside the code create a new hash hash_2,
JSON.parse(SystemConstant.get('Constant_name')).each{|key,val| temp_k=key.split('..').map{|d| Integer(d)}; hash_2[temp_k[0]..temp_k[1]] = val}
The new hash_2 will be the required hash_1