Method: Chop::Create#rename
- Defined in:
- lib/chop/create.rb
#rename(mappings) ⇒ Object
86 87 88 89 90 91 92 93 |
# File 'lib/chop/create.rb', line 86 def rename mappings transformation do |attributes| mappings.reduce(attributes) do |attrs, (old, new)| attrs[new] = attrs.delete(old) if attrs.key?(old) attrs end end end |