General Question

waterskier2007's avatar

How to open a file in ruby?

Asked by waterskier2007 (2058points) April 21st, 2009

I am trying to display an image in a ruby program. I have thought of a way to do this but it may be a completely crazy idea that wont work. what i am thinking is having a html file in the same folder as the ruby code. so on the last line of code it accesses that file and basically redirects the person to the web page with the image that i want them to see. if anyone knows how to do this or knows another method of displaying the image that would be great. i am working on a mac

Observing members: 0 Composing members: 0

11 Answers

James_Mal's avatar

Is this anything you had in mind? You just need the direct URL of the image.

If that’s not what you mean, could you maybe try to be a tad more specific? Or clear. I’m not sure I understand completely. Sorry! Hope that does help though. :P

waterskier2007's avatar

well i suppose that would work if it displays the image for the person running the code. it is an interactive game and i want the image to be like the endscene of the game

waterskier2007's avatar

i dont think this works to display the image, does anyone know of a way to do this?

James_Mal's avatar

Hmmm…. I’ll keep thinkin’ and lookin’ as well. I’ve never needed to do that, so If I figure it out, or see it somewhere, I’ll come back and post. :)

waterskier2007's avatar

aight, thanks man

James_Mal's avatar

Is this what you had in mind? It has 5 pages total, so be sure to read through all of them. It actually is related to your intentions, because it is about loading images in games. So, I think this could be what you are looking for.

If it is, lemme know! If not? Well, I’ll just keep looking!

waterskier2007's avatar

It looks like that code should work, but I cant get it to. i think i dont have ruby game or something installed and i need to know how to set this thing up

James_Mal's avatar

This is a great guide showing how to install it a few different ways.

This is another. I prefer the first link, because It seems to have more methods. And, if one way doesn’t work, there are other ways to try!

Lemme know if any of these helped!

waterskier2007's avatar

that could work. the only problem is i have to send the code to a professor to turn it in. is there a way to have everything in a folder and when they run my code it would install rubygame. the problem is that i dont know if he will be running it on a mac

James_Mal's avatar

Hmm… I’m actually unsure about that. Sadly I’ve never really taken any of my files and moved them any where else. I’m sure there is, because that would be somewhat stupid to not be able to do… I’m sure there are a few forums for this sort of thing. I can point you to this site, and this. Hopefully you can find someone there who seems to know a little more than me.

Sorry!

waterskier2007's avatar

thanks man ill look there

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther