lib/macros4cuke/formatting-service.rb in macros4cuke-0.5.03 vs lib/macros4cuke/formatting-service.rb in macros4cuke-0.5.06
- old
+ new
@@ -1,7 +1,7 @@
# File: formatting-service.rb
-# Purpose: Implementation of the WalkEventPublisher class.
+# Purpose: Implementation of the FormattingService class.
require_relative 'exceptions'
require_relative 'coll-walker-factory'
require_relative './formatter/all-notifications'
@@ -37,13 +37,13 @@
fail(NoFormattingEventForFormatter.new(aFormatter))
end
# Check that each event from the event list the formatter is known.
supported_events.each do |event|
- unless Formatter::AllNotifications.include? event
- fail(UnknownFormattingEvent.new(aFormatter, event))
- end
+ next if Formatter::AllNotifications.include? event
+
+ fail(UnknownFormattingEvent.new(aFormatter, event))
end
formatters << aFormatter
end
@@ -56,14 +56,14 @@
(msg, nesting_level) = visit_event[0..1]
# Notify each formatter of the visit event.
formatters.each do |fmt|
accepted_notifications = fmt.implements
- if accepted_notifications.include? msg
- # Assumption: all nil argument(s) are at the end
- arg_vector = visit_event[2..-1].reject { |an_arg| an_arg.nil? }
- fmt.send(msg, nesting_level, *arg_vector)
- end
+ next unless accepted_notifications.include? msg
+
+ # Assumption: all nil argument(s) are at the end
+ arg_vector = visit_event[2..-1].reject { |an_arg| an_arg.nil? }
+ fmt.send(msg, nesting_level, *arg_vector)
end
end
end
end # class