
URLs in Ruby - jmonegro
http://ozmm.org/posts/urls_in_ruby.html
======
mahmud
In Common Lisp:

    
    
      EPEEN> #u"http://google.com"
      #<URI http://google.com>
    

Thanks to the PURI library :-)

The twitter example.

    
    
      EPEEN> (let ((json (http-request #u"http://twitter.com/statuses/show/6592721580.json")))
    	   (cdr (assoc :text (decode-json-from-string (octets-to-string json)))))
      "He nose the truth."
    
    

Using puri, cl-json, drakma and babel.

~~~
stephencelis
I think the point of the original post is that Ruby can parse URL-like syntax
(e.g., <http://twitter.com/statuses/show/6592721580.json>) as code, no strings
attached.

~~~
sketerpot
That sounds like it might be a little awkward to parse. I think I prefer the
Lisp+PURI syntax, just because you can see where the URL begins and ends
easily, and don't have to worry about how the syntax interacts with the rest
of the language.

~~~
stephencelis
Oh, it's completely awkward, and completely fun. The point wasn't to create a
new library to supplant others (if someone used this code in production, I
think the joke would be on them), it's to have fun with what's possible in
Ruby, and perhaps save a few characters in irb.

