ariejan/imdb — pull request #62 by guilhermesad (2014-06-11 01:49:25+00:00)
Title: Add Person class

Hey Ariejan. I was using your gem for a data visualization project on cinema, and although it did come in handy, there are some functionalities I could use that are not yet implemented. For instance, I would like to get all movies made by some director or actor. So I added this Person class to the project. Its behavior is analogous to Movie's, with the addition of being possible to get all Movie objects from someone:

```ruby
person = Imdb::Person.new("95")
person.name #=> "Woody Allen"
person.age #=> 79

person.movies_as_director #=> (array of Movie objects)
person.movies_as_director.last.title #=> "What's Up, Tiger Lily?"
person.movies_as_actor.last.title #=> "What's New Pussycat"
```

Note that these last methods are made dynamically, since categories (actor, director...) vary according to the person. For example, Meryl Streep would respond to *movies_as_actress*, *movies_as_producer* and so on. We can see all categories somebody is in:

```ruby
meryl_streep.categories
#=> ["Actress", "Soundtrack", "Producer", "Thanks", "Self", "Archive footage"]
```

I intend to keep working on this by doing the following:

- Change Movie#director, Movie#cast_members and other methods so that Person instances are returned
- Write specs
- Update Readme
- Some minor adjustments, such as change *respond_to* to consider dynamic methods; handle age when person is not alive; etc
- Maybe create a class from which Base and Person inherit