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

No implicit conversion of IO into String #487

Closed
jneen opened this issue Jun 7, 2016 · 7 comments
Closed

No implicit conversion of IO into String #487

jneen opened this issue Jun 7, 2016 · 7 comments
Labels
bugfix-request A request for a bugfix to be developed.

Comments

@jneen
Copy link
Member

jneen commented Jun 7, 2016

It seems like #417 was a little overzealous - the FileReader class had been introduced to distinguish between stdin (or '-') and file names. When using rougify to highlight stdin, we now try to call File.read($stdin, encoding: 'utf-8'), which throws an error.

@jneen jneen added the bugfix-request A request for a bugfix to be developed. label Jun 7, 2016
@jneen
Copy link
Member Author

jneen commented Jun 7, 2016

@japj could you take a look at this please?

@jneen
Copy link
Member Author

jneen commented Jun 7, 2016

(when you get a chance - if you don't have the time I'm happy to fix it of course)

@japj
Copy link
Contributor

japj commented Jun 7, 2016

I'll have a look later today, not sure exactly atm how to have a reproduceable test for this to prevent regression in the future. My ruby is fairly rusty

@japj
Copy link
Contributor

japj commented Jun 7, 2016

Ok, I am a bit lost on how to solve this issue due to not programming in ruby for a looong time and the unknowns of the IO subsystem.

Should https://github.com/jneen/rouge/blob/master/lib/rouge/cli.rb#L16 return a different kind of object (this is what I am assuming should happen as the 'correct' fix, but I'm not sure what object it should be exactly for L26 to also still work correctly).

Or should https://github.com/jneen/rouge/blob/master/lib/rouge/cli.rb#L26 contain the old code in case of stdin, but then there is duplication on the case input/when part?

@jneen
Copy link
Member Author

jneen commented Jun 8, 2016

I think you can embed the encoding into the File object with File.new(fname, 'r:utf-8') or similar

@japj
Copy link
Contributor

japj commented Jun 9, 2016

I guess this can be closed then?

@jneen
Copy link
Member Author

jneen commented Jun 10, 2016

Yep!

@jneen jneen closed this as completed Jun 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix-request A request for a bugfix to be developed.
Projects
None yet
Development

No branches or pull requests

2 participants