Module: TelLinkRails::ViewHelper

Defined in:
lib/tel_link_rails/view_helper.rb

Instance Method Summary collapse

Instance Method Details



4
5
6
7
8
9
10
11
# File 'lib/tel_link_rails/view_helper.rb', line 4

def tel_link(number, name = nil, html_options = {}, &block)
  sets_of_numbers = number.scan(/[\+0-9]+/)
  num = "#{sets_of_numbers.join('-')}"

  html_options['href'] = "tel:#{num}"

  (:a, name || number, html_options, &block)
end