params.each do |key, value| self.instance_variable_set("@#{key}", value) self.class.send(:define_method, key, proc { self.instance_valiable_get("@#{key}") }) end
Created
December 14, 2009 19:13
-
-
Save thisivan/256320 to your computer and use it in GitHub Desktop.
Create Attributes Accessor Dynamically in Ruby
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment