An exercise for Prime subscribers. Visit http://learn.thoughtbot.com/prime to learn more.
As a Shakespeare buff, statistics junkie, and unix lover, Ben finds himself wanting a command-line tool for analyzing Macbeth.
Write a command-line program that prints the number of lines spoken by each character in the play.
Sample usage/output (using made-up numbers):
$ ruby macbeth_analyzer.rb
543 Macbeth
345 Banquo
220 Duncan
(etc.)
You can find an XML-encoded version of Macbeth here: http://www.ibiblio.org/xml/examples/shakespeare/macbeth.xml. Your program should download and parse this file at runtime.
Your solution must be tested, preferably via TDD.
- To work on this exercise, fork the repo and begin implementing your solution.
- When you are done, copy the output of your program into a file in this repository.
- Create a pull request so your code can be reviewed.
- Perform a code review on at least one other person's solution. Your comments should follow our code review guidelines: https://github.com/thoughtbot/guides/tree/master/code-review. Most important: be friendly. Make suggestions, not demands.
- Improve your solution based on the comments you've received and approaches you've learned from reviewing others' attempts.
While knowledge and skill improvement are their own rewards, the author with the best solution (as judged by thoughtbot) will receive a cool thoughtbot t-shirt.