Repository is archived
No commit activity in last 3 years
No release in over 3 years
Phone number parser and tel link creator.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

Build Status

AlexanderGrahamBell

Phone number parser and tel link creator.

Install

gem install alexander_graham_bell

Requirements

  • Ruby 2.5.3 or higher

Examples

Generate a tel link

puts AlexanderGrahamBell.tel_link('1-800-555-1234')
# <a href=\"tel:18005551234\">1-800-555-1234</a>

Generate a tel link with an extension

puts AlexanderGrahamBell.tel_link('1-800-555-1234ext5')
#<a href=\"tel:18005551234;isub=5\">1-800-555-1234ext5</a>

Get the href contents

puts AlexanderGrahamBell.tel_href('1-800-555-1234')
# tel:18005551234

For use with rails

# If you're using rails and you want to html escape everything, wrap it in your own module or class.

module MyTelLinkGenerator
  def self.build(phone_number)
    AlexanderGrahamBell.tel_link(phone_number).html_safe
  end
end

MyTelLinkGenerator.build('+18052234567ext5')