Skip to content

Instantly share code, notes, and snippets.

@awesome
Created January 24, 2017 05:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save awesome/f800d91055b8d8c375c98e98eab0a9a5 to your computer and use it in GitHub Desktop.
Add attributes to an object.
def add_attrs(obj, attrs)
attrs.each do |k,v|
obj.send("#{k}=", v)
end
return obj
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment