Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Touting as 100 LOC using only stdlib:

* may show that Ruby can do a lot on its own.

* may show that a developer doesn't have to depend on another gem just to get the job done.

The Ruby stdlib is powerful, and depending on another gem could bite you if it were to become unmaintained at some point.

However, low LOC and use of stdlib isn't always the goal for development in-general.

I want to develop solutions quickly that work well and are easy to maintain. If it's easy to learn also, even better.

In terms of the size of the code, even in text form, there's a lot I could do. I could reduce lines by replacing EOL with semicolon. I could remove unnecessary spaces. I could use shortest variable names. I could store a compressed version of the code in the file and then do eval of the decompressed version. Those don't make it a better solution, unless the goal is to obfuscate and/or minify it.

I know that's not the point, though, and I'm mentioning it only so that people will think about LOC as what it is- just a metric.



It's using something called WEBrick. It's a "default gem", so it sounds like it comes with Ruby.

"WEBrick is an HTTP server toolkit that can be configured as an HTTPS server, a proxy server, and a virtual-host server."

So I'm reading it as 100 loc of setup to use a proxy toolkit to invoke a proxy.


Actually, as of Ruby 3, webrick is no longer a "bundled gem". You'll need to add it to your Gemfile and install it in order to use it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: