Skip to content
This repository has been archived by the owner on Apr 27, 2018. It is now read-only.

Commit

Permalink
Fixed problems with argument validation
Browse files Browse the repository at this point in the history
Validation now works for :remainder arguments and if only some arguments
should be validated.
  • Loading branch information
koraktor committed Jan 23, 2011
1 parent 25d56d8 commit 1c099ff
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/rubikon/has_arguments.rb
Expand Up @@ -199,8 +199,13 @@ def check_args
raise MissingArgumentError.new(@name) unless args_full?
unless @arg_values.empty?
@args.each do |name, arg|
unless arg =~ @arg_values[name]
raise UnexpectedArgumentError.new(arg)
unless @arg_values[name].nil?
arg = [arg] unless arg.is_a? Array
arg.each do |a|
unless a =~ @arg_values[name]
raise UnexpectedArgumentError.new(a)
end
end
end
end
end
Expand Down

0 comments on commit 1c099ff

Please sign in to comment.