Type casting problem when sorting array of Configatron::Dynamic values
codeminator opened this issue · comments
try this in console:
configatron.test.arr = [Configatron::Dynamic.new {Time.now.to_i}, Configatron::Dynamic.new {Time.now.to_i}]
=> [1413583466, 1413583466]
configatron.test.arr.last.to_s
=> "#Configatron::Dynamic:0x0000000394d218"
This is wrong, it should give a string of the timestamp like this:
Time.now.to_i.to_s
=> "1413583779"
Thanks for the report! Actually though, this works as designed — it'd be pretty surprising behavior if we would scan into the internals of objects you assign to us.
Instead, either assign your Dynamics to two different keys, or handle the dynamicism manually after retrieving them.