iruby icon indicating copy to clipboard operation
iruby copied to clipboard

awesome_print not working

Open rattrayalex opened this issue 9 years ago • 5 comments

Hi there,

Awesome tool that I can't wait to properly use! I'm used to rails c with pry, awesome_print, and some other goodies, and was disappointed to see that the awesome_print doesn't appear to work with iruby (either notebook or console). I tried explicitly requiring the gem but it still didn't work. Not sure if/how this could be overcome.

rattrayalex avatar Feb 10 '16 01:02 rattrayalex

Apologies - awesome_print does work in the sense that ap SomeObj works as expected; I just thought that the Out would be awesomeprinted as well. Would be awesome to enable that.

rattrayalex avatar Feb 10 '16 01:02 rattrayalex

I don't understand what you mean exactly. Can you show us an example?

v0dro avatar Feb 10 '16 12:02 v0dro

Yes, sorry, I'm a relative newcomer to ruby and was a bit confused.

Here's a gist that shows what I'm looking for: https://gist.github.com/rattrayalex/6c80a1e6d220d236a2ec

Though I have a hunch that I should really open this issue with the awesome_print team, to ask for a AwesomePrint.iruby! feature -- thoughts?

rattrayalex avatar Feb 10 '16 18:02 rattrayalex

Hello @rattrayalex I do not know the situation in 2016. But now you can do it as follows.

image

kojix2 avatar Apr 17 '19 09:04 kojix2

Another workaround

require 'httparty'
require "awesome_print"

url = "https://postman-echo.com/get?foo1=bar1&foo2=bar2"

result = HTTParty.get(url)
IRuby.html(result.parsed_response.ai(indent: -2, html: true))

Screen Shot 2020-05-27 at 19 14 20

atomsfat avatar May 28 '20 00:05 atomsfat