Based on this I am attempting to use ruby to send a DOI (document object identifier) to crossref.org that should return bibliographic information, making the following call from the command line in WinXP running Ruby 1.9.3-p194:
c:\Ruby193\bin\ruby.exe < rtest.txt
where the file rtest.txt contains
open("http://dx.doi.org/10.1038/nrd842","Accept" => "text/bibliography; style=bibtex"){|f| f.each {|line| print line}}
Instead it doesn't get too far and returns the following:
-:1:in `initialize': Invalid argument - http://dx.doi.org/10.1038/nrd842 (Errno::EINVAL)
from -:1:in `open'
from -:1:in `<main>'
I can invoke ruby as shown to perform other tasks such as deleting a file (gasp). I am wondering then what might alternately be the cause of the error.
it seems you must first require a library such as "open-uri" like in the following example:
Create a file to hold your code, perhaps rtest.rb, inside this file paste the following code:
Save the file, then run with: