alexander_graham_bell 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 384bd7567d4ca649ce2b65748300e1591edcb2d8
4
- data.tar.gz: 61b36765489fcd9d3b8df756cca1ec568dc973ce
3
+ metadata.gz: d35fca9242c8482807144626721bbfe784cd271a
4
+ data.tar.gz: f217ec7dd145a12aa231e4d2c80b87307e4096bb
5
5
  SHA512:
6
- metadata.gz: 6e267e6e5c32d66ba98a269c835ca6d9fcebebccf65c32f62df0f15ce3c48b1ba4f36a79912e0f961747ef0383c00b95faae504e1902567123827f488fa26fe3
7
- data.tar.gz: 8e9e991b5e3e6093cfbb32c74b5f6cde70ccb15f4535dc0138509419768a84461ef4d4f3c4ec3f19fbc8908634c6948b860c7df918234480f5a0b96f332da2f5
6
+ metadata.gz: f2048efbeac23c2881feec4758564bcf6ec84729b38920f32c14f3d0f2b850c0c5fb8265da05bcc65bc666440cbc1dd6c450e2e104053f73ceba962e3c8c0094
7
+ data.tar.gz: 35a4beea8c093ded131097b1432ee3d9007aa1cbdddb4f723913d81ad66f0c3f066852c4da7aa0ec48174b0ecd1f2fe0c59ce02799386fbe7450d270648c7e7d
data/README.md CHANGED
@@ -1 +1,38 @@
1
- # alexander-graham-bell
1
+ # AlexanderGrahamBell
2
+
3
+ Phone number parser and tel link creator.
4
+
5
+ ## Install
6
+
7
+ ```
8
+ gem install alexander_graham_bell
9
+ ```
10
+
11
+
12
+ ## Requirements
13
+
14
+ * Ruby 2.2.3 or higher
15
+
16
+ ## Examples
17
+
18
+ ```ruby
19
+ # Use the class methods to generate a tel link
20
+ puts AlexanderGrahamBell.tel_link('1-800-275-2273')
21
+ # <a href=\"tel:18002752273\">1-800-275-2273</a>
22
+
23
+ # Extensions
24
+ puts AlexanderGrahamBell.tel_link('+18052234567ext5')
25
+ #<a href=\"tel:+18052234567;isub=5\">+18052234567ext5</a>
26
+ ```
27
+ ###rails
28
+ ```ruby
29
+ # If you're using rails and you want to html escape everything wrap it in your own module or class.
30
+
31
+ module MyLinkGenerator
32
+ def self.build(phone_number)
33
+ AlexanderGrahamBell.tel_link(phone_number).html_safe
34
+ end
35
+ end
36
+
37
+
38
+ ```
@@ -3,16 +3,18 @@ require 'alexander_graham_bell/version'
3
3
  require 'alexander_graham_bell/phone'
4
4
 
5
5
  module AlexanderGrahamBell
6
- def self.tel_link(phone_number, escaper = ERB::Util.method(:h))
7
- phone = Phone.new(phone_number)
8
- escaped_phone_number = escaper ? escaper.call(phone_number) : phone_number
9
- return escaped_phone_number unless phone.valid?
10
- "<a href=\"tel:#{phone.number}#{isub(phone)}\">#{escaped_phone_number}</a>"
11
- end
6
+ class << self
7
+ def tel_link(phone_number, escaper = ERB::Util.method(:h))
8
+ phone = Phone.new(phone_number)
9
+ escaped_phone_number = escaper ? escaper.call(phone_number) : phone_number
10
+ return escaped_phone_number unless phone.valid?
11
+ "<a href=\"tel:#{phone.number}#{isub(phone)}\">#{escaped_phone_number}</a>"
12
+ end
12
13
 
13
- private
14
+ private
14
15
 
15
- def self.isub(phone)
16
- ";isub=#{phone.extension}" unless phone.extension.nil?
16
+ def isub(phone)
17
+ ";isub=#{phone.extension}" unless phone.extension.nil?
18
+ end
17
19
  end
18
20
  end
@@ -1,3 +1,3 @@
1
1
  module AlexanderGrahamBell
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alexander_graham_bell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Speidel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-03-02 00:00:00.000000000 Z
12
+ date: 2016-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -93,8 +93,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  version: '0'
94
94
  requirements: []
95
95
  rubyforge_project:
96
- rubygems_version: 2.4.8
96
+ rubygems_version: 2.4.5.1
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: Phone number parser and tel link creator.
100
100
  test_files: []
101
+ has_rdoc: