/shakespeare_analyzer

An exercise for Prime subscribers.

Primary LanguageRuby

An exercise for Prime subscribers. Visit http://learn.thoughtbot.com/prime to learn more.

Difficulty level: intermediate.

Your Task

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.

Working/Submitting

  1. To work on this exercise, fork the repo and begin implementing your solution.
  2. When you are done, copy the output of your program into a file in this repository.
  3. Create a pull request so your code can be reviewed.
  4. 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.
  5. Improve your solution based on the comments you've received and approaches you've learned from reviewing others' attempts.

Bounty

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.