Paste number 43641: check out my crazy meta-programming

Paste number 43641: check out my crazy meta-programming
Pasted by: jrochkind
When:2 years, 6 days ago
Share:Tweet this! | http://paste.lisp.org/+XO9
Channel:#code4lib
Paste contents:
Raw Source | XML | Display As
        # Take a hash, and set attributes for keys to values. Like ActiveRecord does.
    def initialize( h )
      h.each do | key, val |
        if self.respond_to( "#{key}=").intern )
          self.send( "#{key}=".intern, val )
        else 
          self.instance_variable_set( "@#{key}".intern, val )
        end
      end
    end

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.