Rails static data set
I would store this information in a YAML file. You could use the RailsConfig gem and create a YAML file like
level: 1: some: value another: value 2: some: second value another: second value
And then access it with
rate = 2val = Settings.level[rate.to_s].some
(I'm not completely sure with numbers as keys in YAML, maybe you have to escape them)
I use constants in this cases: constants do not change after the declaration, but the declaration can be dynamic:
OS = case RUBY_PLATFORM when /linux/ then :linux when /osx/ then :osx when /windows/ then :windows else :unknown
Performance should be better when using constants for static values, because they should be memoized (and because staticity should be their purpose, so probably Ruby implementations trust about it; I read something about JRuby and constants implementation, I'll post it if I'll find. EDIT I found it: http://blog.headius.com/2012/09/avoiding-hash-lookups-in-ruby.html).