lib/hanami/components/component.rb in hanami-1.2.0 vs lib/hanami/components/component.rb in hanami-1.3.0.beta1

- old
+ new

@@ -44,10 +44,16 @@ resolved(name, _resolve.call(configuration)) end private + # @since 1.3.0 + # @api private + # + # @see Hanami::Component#logger_interface? + LOGGER_METHODS = %i[info warn debug] + # Component name # # @return [String] # # @since 0.9.0 @@ -160,9 +166,17 @@ # @api private # # @see Hanami::Components.resolved def resolved(name, value = nil, &blk) Components.resolved(name, value, &blk) + end + + # Check that instance has logger interfaces (#info, #warn and #debug) + # + # @since 1.3.0 + # @api private + def logger_interface?(instance) + LOGGER_METHODS.all? { |method| instance.respond_to?(method) } end end end end