Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raw Mode to avoid double encoding #103

Open
pathsny opened this issue Jul 27, 2023 · 3 comments
Open

Raw Mode to avoid double encoding #103

pathsny opened this issue Jul 27, 2023 · 3 comments

Comments

@pathsny
Copy link

pathsny commented Jul 27, 2023

I have code that uses ap with some default options to print data. At times i'd like to pre-format some data and pass it in. However passing in object.ai(options) results in the string being encoded twice. I'd like to be able to set some sort of "raw" option or to have ai return a wrapped object that should be displayed as is.

@HarlemSquirrel
Copy link
Member

Hi @pathsny do you have an example you can share?

@johnpitchko
Copy link

I don't know @pathsny 's specific requirement, but a raw mode would be useful on Rails #to_sql command. With AmazingPrint, you receive an ASCII-encoded string "SELECT \"users\".* FROM \"users\"" with all the backspace noise, however puts provides the clean string SELECT "users".* FROM "users", which is much easier to read.

@HarlemSquirrel
Copy link
Member

@johnpitchko that example seems like where we would just want to use puts like this

image

I am open to a PR if folks think it's useful though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants