Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

appfolio/alexander_graham_bell

Repository files navigation

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')

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •