×

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.

And that’s it…

Happy rounding :).

Leave a Reply

Your email address will not be published. Required fields are marked *

Author

admin@gmail.com

Related Posts

Stream Vibora’s New Screamo Opus Egin Ez Dugun Guztia

So many moments on this album made me go “WOO!” We first encountered the Vitoria Gasteiz, Spain screamo/post-hardcore band Vibora when they...

Read out all

RIOT SON Turns Momentum Into Emotion With “What Makes You Think” A Magnetic, Euphoric Statement That Hits Hard

RIOT SON Turns Momentum Into Emotion With “What Makes You Think” A Magnetic, Euphoric Statement That Hits Hard top of page bottom...

Read out all

Maria BC Shares New Song “Rare”: Listen

The otherworldly Maria BC is back with another spectral single from their forthcoming album Marathon. This one’s called “Rare,” and it follows...

Read out all

Ripsime Unleashes Euphoric Power and Magnetic Vision With Triple Re-Releases “Dare,” “Colours of Your Eyes,” and “I’ll Understand” in a Fearless, Exhilarating Moment of Arrival

Ripsime Unleashes Euphoric Power and Magnetic Vision With Triple Re-Releases “Dare,” “Colours of Your Eyes,” and “I’ll Understand” in a Fearless, Exhilarating...

Read out all

friends& Release New Album ‘folx’: Listen

Are you ready for a high-concept 112-track sampledelic glitch-pop album about, among other things, the commodification of folk music? Some background on...

Read out all

DAAY Curates A World Of Control, Emotion, And Vision With ‘Memories Of The Future’

DAAY Curates A World Of Control, Emotion, And Vision With ‘Memories Of The Future’ top of page bottom of page

Read out all