Sunday 15 July 2012

How can I DRY up this ruby array of hashes? -


How can I dry this rabbi array in a hash? The repetitive code is a smell, but I'm not sure how to clean it. 38 [/ 0], [@ 0], [@] [@] [@] [@] [@] [@] [@] [@] [@ time] ] Price [0], 42 @@ Line_Pars [row] [@ time [2]] Price [0], 43 @@ line_on [row] [@ time [3]]. Value [0]] 44 End

  def get_parts (line) (0 ..3) .collect {| I | @@ row_parse [row] [@ time [i]]. Note [/ 0]   

Use the following attributes of Ruby:

  • Map - (gather)
  • / html>

No comments:

Post a Comment