Skip to content

Instantly share code, notes, and snippets.

@smileart
Created September 22, 2020 07:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smileart/1b9217389904580316780e7c2a0d466a to your computer and use it in GitHub Desktop.
Save smileart/1b9217389904580316780e7c2a0d466a to your computer and use it in GitHub Desktop.
tapp + amazing_print
require 'tapp'
require 'tapp/printer'
require 'amazing_print'
# Module to define own Tapp printer
module Tapp::Printer
# Custom AmazingPrint based printer for Tapp
class AmazingPrint < Base
# Prints the object using custom (AmazingPrint) printer
#
# @param [Object, Array] *args arbitrary Object to print
#
# @return [nil] prints to IO, returns nothing
def print(*args)
ap *args
end
end
register :amazing_print, AmazingPrint
end
# Configure Tapp to use our custom printer and report caller
Tapp.configure do |config|
config.report_caller = true
config.default_printer = :amazing_print
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment