Sha256: 5d1640aa9f9787c03b59886f93649792b7f3d2ed416ceaabed23304733d17f1e

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

module WithClues
  class Html
    def dump(notifier, page:, context:, captured_logs: [])
      access_page_html = if page.respond_to?(:html)
                           ->(page) { page.html }
                         elsif page.respond_to?(:content)
                           ->(page) { page.content }
                         elsif page.respond_to?(:native)
                           ->(page) { page.native }
                         else
                           notifier.notify "Something may be wrong. page (#{page.class}) does not respond to #html, #native, or #content"
                           return
                         end
      notifier.blank_line
      notifier.notify "HTML {"
      notifier.blank_line
      notifier.notify_raw access_page_html.(page)
      notifier.blank_line
      notifier.notify "} END HTML"
      if captured_logs.any?
        notifier.notify "LOGS {"
        notifier.blank_line
        captured_logs.each do |log|
          notifier.notify_raw log
        end
        notifier.blank_line
        notifier.notify "} END LOGS"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
with_clues-1.3.0 lib/with_clues/html.rb