[英]How do you disable awesome_print once enabled in IRB or rails console?
我將awesome_print配置為我在IRB中的默認格式化程序(在我的.irbrc中使用AwesomePrint.irb!
)雖然這通常很棒,但我想有時將其關閉。 有人知道如何從正在運行的IRB / Rails控制台?
您可以將其粘貼到終端中,以根據需要將其重置為原始狀態:
IRB::Irb.class_eval do
def output_value # :nodoc:
printf @context.return_format, @context.inspect_last_value
end
end
或者,您也可以使用整個豬和猴子補丁AwesomePrint:
module AwesomePrint
def self.un_irb!
IRB::Irb.class_eval do
def output_value # :nodoc:
printf @context.return_format, @context.inspect_last_value
end
end
end
end
然后隨時隨地調用它: AwesomePrint.un_irb!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.