| 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: |
# 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
endThis paste has no annotations.