Created
September 22, 2020 07:04
-
-
Save smileart/1b9217389904580316780e7c2a0d466a to your computer and use it in GitHub Desktop.
tapp + amazing_print
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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