(Follow-up on part 1)
One of the great and powerful things about Ruby is its ability to expressively extract common patterns through metaprogramming. Even the standard library in Ruby provides some good examples. One of my favorites is the generation of getter/setter methods for instance variables, the attr methods:
class Person
attr_reader :name # adds 'name' method (getter)
attr_writer :phone # adds 'phone=' method (setter)
attr_accessor :address # adds both 'address' and 'address='
attr :gender # same as attr_accessor
end
Using the metaprogramming techniques like this, we’re going to clean up a few things in feed_tools.
