Opening URL from Ruby program

I'm creating a "admin tool" program that will allow you to update the users information along with add/delete users from a terminal. I have an option to view all users and instead of opening my yaml file that contains all the users information I want to open the URL to the users database. Do I have to require "uri"? Or is there any other way to do this?

···

Sent from my iPhone

Hi Thomas,

I am new to ruby etc, but maybe this will be useful in regard to your question. Sorry if not ))

Best Regards,
Rodion

···

On Nov 1, 2015, at 16:59, thomas Perkins <thomas.perkins23@icloud.com> wrote:

I'm creating a "admin tool" program that will allow you to update the users information along with add/delete users from a terminal. I have an option to view all users and instead of opening my yaml file that contains all the users information I want to open the URL to the users database. Do I have to require "uri"? Or is there any other way to do this?

Sent from my iPhone

Yeah,sure

···

On Nov 1, 2015 8:29 PM, "thomas Perkins" <thomas.perkins23@icloud.com> wrote:

I'm creating a "admin tool" program that will allow you to update the
users information along with add/delete users from a terminal. I have an
option to view all users and instead of opening my yaml file that contains
all the users information I want to open the URL to the users database. Do
I have to require "uri"? Or is there any other way to do this?

Sent from my iPhone

thomas Perkins <thomas.perkins23@icloud.com> writes:

instead of opening my yaml file that
contains all the users information I want to open the URL

So you have an URL that links to a YAML file, right? And what you want
is to download the YAML file and then use it as if it was a local file?
There is “open-uri” in Ruby’s stdlib that does exactly that:

···

----------------------------------------
require "yaml"
require "open-uri"

hsh = open("http://example.com/myfile.yml&quot;\){|page| YAML.load(page.read)}
----------------------------------------

HTH
Marvin

--
#!/sbin/quintus
Blog: http://www.guelkerdev.de

GnuPG key: F1D8799FBCC8BC4F