everypolitician / everypolitician-ruby

Ruby gem for easy access to EveryPolitician data
http://everypolitician.org/
MIT License
14 stars 5 forks source link

Define #to_s on Country and Legislature #5

Open chrismytton opened 8 years ago

chrismytton commented 8 years ago

Add a #to_s method so that when a Country or Legislature is interpolated in a string it uses the name property of that object.

Current behaviour:

[1] pry(main)> country = Everypolitician.country('Australia')
=> #<Everypolitician::Country:0x007f99dc1e9628>
[2] pry(main)> "Fetching data for #{country}"
=> "Fetching data for #<Everypolitician::Country:0x007f99dc1e9628>"

Desired behaviour:

[1] pry(main)> country = Everypolitician.country('Australia')
=> #<Everypolitician::Country:0x007f99dc1e9628>
[2] pry(main)> "Fetching data for #{country}"
=> "Fetching data for Australia"
tmtmtmtm commented 8 years ago

@octopusinvitro let's see how many of these you can clear tomorrow!