meta-initializers

While reading something of why’s on meta-programming, and looking at some of his example code

class MailTruck
  attr_accessor :driver, :route
  def initialize( driver, route )
    @driver, @route = driver, route
  end
end


I thought to myself “why don’t we have something as DRY as attr_accessor for meta-programming the initialize method? Why not something like

class MailTruck
  attr_accessor :driver, :route
  initializer :driver, :route 
end

?”
In other words, why write “driver, route” three times?

A project for a rainy day…

Advertisements
Explore posts in the same categories: Random Nonsense, Ruby

Tags:

You can comment below, or link to this permanent URL from your own site.

One Comment on “meta-initializers”


  1. […] Life, the Universe, and Everything thoughts on technology, truth, & transformation « meta-initializers […]


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: