x = 4_924


case x
when 0..100
  1
when 101..500
  2
when 501..1_000
  3
when 1_001..5_000
  4
when 5_000..1_000_000
  5
else
  0
end

I would like to turn the above into:

(a) a hash instead
(b) store it into a yaml file.

This is actually a XP Table for Levels. Like, you reach level 3 when you
have at least 501 xp and at maxim 1000 xp.

-- 
Posted via http://www.ruby-forum.com/.