rubyx
rubyx copied to clipboard
Longer Strings
https://github.com/ruby-x/rubyx/blob/master/lib/parfait/word.rb
Strings are currently limited to i think 20 chars. This is starting to be a problem.
The solution is to have "extensions" (better naming welcome). This means when a string goes over the max, a new string should be created and linked into the original as an "extension" . The attribute next_word, where this extension should go, is already there.
The work is to make all the existing methods extension aware. Basic examples:
- length needs to check extension and possibly add it
- [] index operator needs to check if index is in extension and pass the request on
In effect the Word becomes a linked list, and that needs to be managed. As a reference, BinaryCode does a very similar thing https://github.com/ruby-x/rubyx/blob/master/lib/parfait/binary_code.rb