If you want to integrate Ruby code with an HTML interface, you basically have a couple of options: CGI and Rack (which is just a much more modern implementation of CGI, IMO). There were tons of examples of both on Google last time I checked. Either of these will provide you a way to map Web form inputs to the Ruby script's STDIN interface.
You cannot call ruby within the browser, you have to use javascript or
similar. You can of course make requests to the server in the normal
way, where you can use ruby.