https://github.com/appfolio/alexander_graham_bell
https://github.com/appfolio/alexander_graham_bell
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/appfolio/alexander_graham_bell
- Owner: appfolio
- Created: 2016-02-29T23:03:29.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2025-05-03T18:11:21.000Z (about 1 year ago)
- Last Synced: 2025-05-07T21:54:59.940Z (about 1 year ago)
- Language: Ruby
- Size: 26.4 KB
- Stars: 1
- Watchers: 132
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
[](https://circleci.com/gh/appfolio/alexander_graham_bell.svg?style=svg)
# 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
```ruby
puts AlexanderGrahamBell.tel_link('1-800-555-1234')
# 1-800-555-1234
```
#### Generate a tel link with an extension
```ruby
puts AlexanderGrahamBell.tel_link('1-800-555-1234ext5')
#1-800-555-1234ext5
```
#### Get the href contents
```ruby
puts AlexanderGrahamBell.tel_href('1-800-555-1234')
# tel:18005551234
```
#### For use with rails
```ruby
# 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')
```