Ruby on Rails Round Corners library. Easy to install and use.
This is a very simple library based on RMagick gem for Ruby on Rails that generates “Round Corners Boxes”.
The Boxes are liquid and generated only once, at first request, after which they’re served as static .PNG files.
There is also a helper available to keep your views clean and easy to manipulate:
The code
<%= round_rectangle_start(10, “#333333”, “#F1FFCC”) %>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure.
<%= round_rectangle_end %>
The result
Arguments are the radius of the corner, the foreground color and the background color.
As requirements there are only two: RMagick installed (preferably 2.0) and a folder in your public/images, named round_rectangle.
That’s all… and hope i’ll make a plugin as soon as I have some time to spare :).
So, what you need to do?
Put round_rectangle.rb library in lib folder or any folder that Rails loads on boot.
Rename HELPER_round_rectangle.rb helper in helpers folder and rename it round_rectangle.rb or parse the code in any helper you use.
Make sure the round_rectangle folder exists in public/images.
You must require ‘Rmagick’ in your environment.rb.
