lib/simple/service/action.rb in simple-service-0.2.0 vs lib/simple/service/action.rb in simple-service-0.2.1

- old
+ new

@@ -79,9 +79,15 @@ verify_required_args!(args, flags) positionals = build_positional_arguments(args, flags) keywords = build_keyword_arguments(args.merge(flags)) + # check for extra flags + extra_flags = (flags.keys - keywords.keys.map(&:to_s)).map { |flag| "--#{flag}" } + unless extra_flags.empty? + raise Simple::Service::ArgumentError, "Unknown flag(s): #{extra_flags.join(", ")}." + end + service_instance = Object.new service_instance.extend service if keywords.empty? service_instance.public_send(@name, *positionals)