Last active
August 29, 2015 14:18
-
-
Save jasononaquest/af3b42eae9d1156346de to your computer and use it in GitHub Desktop.
copy_list.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CopyList | |
attr_reader :list, :new_name | |
def initialize(list, new_name) | |
@list = list | |
@new_name = new_name | |
end | |
def call | |
new_list = List.new(list.dup.attributes.merge(name: new_name)) | |
new_list.save | |
new_list | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment