I am aware that you can implement Javascript code to an HTML documents, by inserting the code between the <script></script>
tags.. is there a similar way to do this with Ruby?
If your question refers to executing Ruby code on the browser, like you would execute Javascript (the server isn't involved), than it's not really possible in the traditional sense.
However, Opal (or similar transpilers) will "compile" your Ruby code into Javascript, allowing you to execute the compiled "Ruby" (now javascript) code within the browser, just like native Javascript (sometimes even better, as Opal attempts to optimize your code).
Ruby is often used to run code on the server rather than the browser. There are a number of solutions.
For example, you can use ERB templates - here's a good intro to ERB - as well as other Ruby template engines (i.e. the amazing Slim template engine) to run Ruby code in a similar way to PHP code (only easier to write and maintain).
However, Ruby is much more powerful than simple templates. There are whole servers and frameworks written in and for Ruby, allowing you very powerful server-side scripting.
The common frameworks:
Ruby on Rails is a very common framework many beginners often start with.
Sinarta is also a good starting point, usually favored by more experienced coders who tend to believe it's less heavy than Rails.
Using Rack directly (with no framework) is the hi-performance mainstream choice, but it requires more knowledge.
Read the following link for more common Http-Web frameworks and Benchmarks.
There are also more experimental, or less common, frameworks - usually ones focusing on real-time web applications, such as Volt and Plezi.