The three rules of Ruby Q.:
Please do not post any solutions or spoiler discussion for this quiz
48 hours have passed from the time on this message.
Support Ruby Q. by submitting ideas as often as you can:
Suggestion: A [QUIZ] in the subject of emails about the problem helps
on Ruby T. follow the discussion. Please reply to the original quiz
if you can.
by Ryan W.
I use Eclipse (with RadRails!) I have a bunch of files open in tabs.
files are open, Eclipse starts to truncate the names so that everything
It truncates them from the right, which means that pretty soon I’m left
to tell which tab is “users_controller.rb” and which is
“users_controller_test.rb”, because they’re both truncated to
The quiz would be to develop an abbrev-like module that shortens a set
strings so that they are all within a specified length, and all unique.
shorten the strings by replacing a sequence of characters with an
character [U+2026]. If you want it to be ascii-only, use three periods
but keep in mind that then you can only replace blocks of four or more
It might look like this in operation:
=> [‘users_c…’, ‘use…test’, ‘account…’, ‘acc…test’, ‘bacon’]
There’s a lot of leeway to vary the algorithm for selecting which
crop, so extra points go to schemes that yield more readable results.