1) no LICENSE file
2) not configurable
3) not idiomatic ruby (e.g. camelCase not snake_case)
4) overtly complicated. A better, and shorter version, is:
bad_whitespace = " "
ARGF.inplace_mode = ""
ARGF.each_line do |line|
print line.gsub(" ", bad_whitespace)
end
5) bad commenting. The style of commenting each line for what it does is often silly. Something like "fileModified.close # Close file" tells me exactly nothing more than reading the code. Having "noisy" comments makes important comments less obvious, and thus actually makes the overall commenting worse.This is a sign of a college coder who had some class where the teacher said "you're required to have at least this much commenting", or a beginner programmer.
And finally, this is obviously a dumb toy program.
This isn't useful to show-hn. This isn't anything novel, or even interesting. It's not hard to do. It's poorly implemented and not portable (really, why require the user to edit the filename? ARGF exists for a reason).
This was also submitted by a new hn account mere hours after it was created (clearly by the author). I have no problem with showing off your own work, but at least let it cool down to see if it's a good idea; see that other people think it's interesting or useful in its own right.
I consider presenting an essentially 5-line program that is not generally useable or insightful as being basically spam.
I do recommend keeping on programming and, once you've got a project you're proud of that has seen some use besides yourself, seen at least one other happy user, and relates to HN's interests, post away!
If it's not interesting to you don't upvote the post but saying it's "dumb" and "ARGF exists for a reason" is just being rude.
'print' does not
The code does handle/preserve all the cases you mentioned (\r\n, final or no final terminating newline, etc).
In the end I configured Emacs to highlight all unicode characters, trailing whitespace and tabs bright red. I also had it render zero width characters as normal spaces, otherwise they were still invisible. https://github.com/kzar/emacs.d/blob/master/init.el#L181-L19...