You can edit both Ruby and HTML code with whatever text editor you want, because both are just written as plain text. So you can open up such a file in TextEdit (in text mode, not rich text) and start playing around. Save HTML files as .html (like “hello.html”) and Ruby files as .rb (like “test.rb”).
Now, as for running: you can drag HTML files into Safari and it should show the page.
Ruby is kind of a different beast, as you need something to run the Ruby code. That’s where the ruby
program comes in. Go to Applications, then Utilities, and open Terminal. Then in the terminal, you will want to go to the directory where you keep your code, and then type “ruby myfile.rb”. Ruby should then interpret and run your program – or give an error message indicating what’s wrong with your program.
If you’re not familiar with the terminal, check out
this introduction by MacApper.
This is a lot to grasp at once, and lots of it might have gone over your head. That’s okay. Like Darth.Titan suggested, you should go to a book store or library and see if you can find a book on HTML and one on Ruby to gently introduce you to each of these languages. Know that you won’t learn either of those overnight.
Maybe you don’t want to become a HTML or Ruby programmer, but just get X or Y done. In that case, try out programs like iWeb (comes with your Mac) or
RapidWeaver for websites, and something like Automator (also included) for automating tasks.