Refactor action arguments checks

This commit is contained in:
Thibault Jouan committed 2014-10-09 19:54:43 +00:00
1 parent 5549ebc676
commit 7bdb778159
3 files changed
+8 -8

No files matched your search

+1 -4
View File
@@ -3,10 +3,7 @@ module Producer
module Actions
class FileAppend < Action
def setup
if arguments.compact.size != 2
fail ArgumentError, '`%s\' action requires 2 arguments' % name
end
check_arguments_size! 2
@path, @content = arguments
end
+1 -4
View File
@@ -3,10 +3,7 @@ module Producer
module Actions
class FileWriter < Action
def setup
if arguments.compact.size != 2
fail ArgumentError, '`%s\' action requires 2 arguments' % name
end
check_arguments_size! 2
@path, @content = arguments
@options[:permissions] = @options.delete :mode if options.key? :mode
@options[:owner] = @options.delete :user if options.key? :user