Skip to content

Instantly share code, notes, and snippets.

@nassredean
Created December 16, 2015 16:12
Show Gist options
  • Save nassredean/da2934fa5eb6ab9b09d2 to your computer and use it in GitHub Desktop.
Save nassredean/da2934fa5eb6ab9b09d2 to your computer and use it in GitHub Desktop.
module Kernel
def ai(options = {})
ap = AwesomePrint::Inspector.new(options)
awesome = ap.awesome self
if options[:html]
awesome = "<pre>#{awesome}</pre>"
awesome = awesome.html_safe if defined? ActiveSupport
end
awesome
end
alias :awesome_inspect :ai
def ap(object, options = {})
puts object.ai(options)
object unless AwesomePrint.console?
end
alias :awesome_print :ap
module_function :ap
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment