[ fields[ 1..4 ], fields[ 4..5 ], 0, 0 ].flatten should work in Ruby; passing a range to Array#[] returns the specified subarray.
Update: And additionally it'd be more idiomatic to use do . . . end rather than {} around your blocks. Granted I don't think it makes a difference in this case but the later does bind more tightly than the former.
In reply to Re^4: OT: Ruby On Rails - your thoughts?
by Fletch
in thread OT: Ruby On Rails - your thoughts?
by Cody Pendant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |