topfunky/gruff — pull request #112 by h0tl33t (2014-06-27 18:32:59+00:00)
Title: Refactor Gruff::Pie to Improve Ability to Subclass

I wanted to be able to tweak a few specific pieces of functionality in `Gruff::Pie` charts, but wasn't able to unless I overwrote both the `draw` and `draw_label` methods, which currently contain pretty much all the functionality. In order to avoid a bunch of duplication when overwriting methods, I refactored `Gruff::Pie` by breaking the `draw` and `draw_label` methods into much smaller component methods.

If I want to change a specific value, I can then simply subclass from `Gruff::Pie` in my app and re-write maybe the one or two methods that deal specifically with the logic I wanted to change.

I wanted to share the work I did here in case it might be helpful for others. Thanks!