<img src=“https://badge.fury.io/rb/link_url.png” alt=“Gem Version” />
link_url¶ ↑
FEATURES:¶ ↑
link_url is the best gem for converting url and images into links and image tags from the string or text into the links. It can convert the url’s which contain http://, https, www. or naked domain from the string. No need to thing about the REGEX. It is the best one because it contains three diffrent functions so you can use as per your requirments. It have a good ability to convert emails into email links
# LinkUrl.convert(“Your Content”)
-
It converts all the url’s into the links.
# LinkUrl.convert_image(“Your Content”)
-
It converts only image’s url into the image tag and remain other url normal.
# LinkUrl.convert_all(“Your Content”)
-
It converts image url’s into the image tag and other url’s into the links.
DESCRIPTION:¶ ↑
require 'link_url' #string => Hi my new website http://www.bookofskills.com ! Please come at us to reward me. LinkUrl.convert("Hi my new website http://www.bookofskills.com ! Please come at us to reward me.") #result => Hi my new website <a href='http://www.bookofskills.com'>http://www.bookofskills.com</a> ! Please come at us to reward me. #string => It is good to search on https://www.clecotech.in LinkUrl.convert("It is good to search on https://www.clecotech.in") #result => It is good to search on <a href='https://www.clecotech.in'>https://www.clecotech.in</a>", #string => www.ashishprajapati.com is my personal website. LinkUrl.convert("www.ashishprajapati.com is my personal website.") #result => <a href='http://www.ashishprajapati.com'>www.ashishprajapati.com</a> is my personal website. #string => I have created many websites and some of them are www.clecotech.in http://www.aptrick.in , www.bookofskills.com , https://rubygems.org and http://www.codead.com LinkUrl.convert("I have created many websites and some of them are www.clecotech.in http://www.aptrick.in , www.bookofskills.com , https://rubygems.org and http://www.codead.com") #result => I have created many websites and some of them are <a href='http://www.clecotech.in'>www.clecotech.in</a> <a href='http://www.aptrick.in'>http://www.aptrick.in</a> , <a href='http://www.bookofskills.com'>www.bookofskills.com</a> , <a href='https://rubygems.org'>https://rubygems.org</a> and <a href='http://www.codead.com'>http://www.codead.com</a>" #string => Hi I have updated the code. my website is www.ashishprajapati.com you can see my pic using www.ashishprajapati.com/ashish.png LinkUrl.convert_image("Hi I have updated the code. my website is www.ashishprajapati.com you can see my pic using www.ashishprajapati.com/ashish.png") #result => Hi I have updated the code. my website is www.ashishprajapati.com you can see my pic using <img src='www.ashishprajapati.com/ashish.png' />" #string => Hi I have updated the code. my website is www.ashishprajapati.com you can see my pic using www.ashishprajapati.com/ashish.png LinkUrl.convert_all("Hi I have updated the code. my website is www.ashishprajapati.com you can see my pic using www.ashishprajapati.com/ashish.png") #result => Hi I have updated the code. my website is <a href='www.ashishprajapati.com'>www.ashishprajapati.com</a> you can see my pic using <img src='www.ashishprajapati.com/ashish.png' /> #string => Hello my email is mail@ashishprajapati.com . You can visit my blog at clecotech.in LinkUrl.convert("Hello my email is mail@ashishprajapati.com . You can visit my blog at clecotech.in") #result => Hello my email is <a href='mailto:mail@ashishprajapati.com'>mail@ashishprajapati.com</a> . You can visit my blog at <a href='http://clecotech.in'>clecotech.in</a>
REQUIREMENTS:¶ ↑
-
rails > 3.1
INSTALL:¶ ↑
-
gem install link_url