From http://www.codingdojo.org/cgi-bin/index.pl?KataWordWrap
You write a class called Wrapper, that has a single static function named wrap that takes two arguments, a string, and a column number. The function returns the string, but with line breaks inserted at just the right places to make sure that no line is longer than the column number. You try to break lines at word boundaries.
Like a word processor, break the line by replacing the last space in a line with a newline.
Implemented during a BCN Software Craftsmanship Coding Dojo.
- Navigate to the project directory.
- Install the dependencies with
bundle install
- Run the tests with
bundle exec cucumber
This is the code as it was at the end of the coding dojo. Don't take it as an indication of our best work :)
In particular:
- The last test is currently failing.
- There are no comments.
- Cucumber BDD testing framework
- Word wrap coding kata
- Barcelona Software Craftsmanship @ Meetup.com
- The Craftsman 62, The Dark Path
- Javier Seixas dev@javierseixas.com
- Abraão Lourenço: abraao@alourenco.com