lib/watir/after_hooks.rb in watir-7.1.0 vs lib/watir/after_hooks.rb in watir-7.2.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module Watir
#
# After hooks are blocks that run after certain browser events.
# They are generally used to ensure application under test does not encounter
# any error and are automatically executed after following events:
@@ -31,11 +33,11 @@
# @yield after_hook block
# @yieldparam [Watir::Browser]
#
def add(after_hook = nil, &block)
- if block_given?
+ if block
@after_hooks << block
elsif after_hook.respond_to? :call
@after_hooks << after_hook
else
raise ArgumentError, 'expected block or object responding to #call'
@@ -97,11 +99,11 @@
# Yields each after hook.
#
# @yieldparam [#call] after_hook Object responding to call
#
- def each(&blk)
- @after_hooks.each { |after_hook| blk.call(after_hook) }
+ def each(&block)
+ @after_hooks.each(&block)
end
#
# Returns number of after hooks.
#