class Rundown::Processors::Phone
Attributes
formatter[RW]
text[RW]
Public Class Methods
new(words, formatter=Phony)
click to toggle source
# File lib/rundown/processors/phone.rb, line 6 def initialize(words, formatter=Phony) @text = words @formatter = formatter end
Public Instance Methods
format(number)
click to toggle source
# File lib/rundown/processors/phone.rb, line 11 def format(number) number.start_with?('0') ? number : formatter.formatted(number) end
process()
click to toggle source
# File lib/rundown/processors/phone.rb, line 15 def process remove_punctuation(text).scan(/\d{7,13}/).map {|number| format(number) } end