public
Created

  • Download Gist
workaround_split.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
module Phony
class << self
alias_method :split_default, :split
 
def split(phone_number)
split_default(phone_number).map {|part|
puts "#{part.class.inspect} -> #{part.inspect}"
if !part.is_a?(Fixnum) && !part.is_a?(String) || (part.respond_to?(:match) && part.match(/Phony::/))
part = nil
end
part
}
end
end
end

I wonder if this would cover all the bases as well?

module Phony
  class << self
    alias_method :split_default, :split

    def split(phone_number)
      split_default(phone_number).map { |part| part if part.respond_to? :to_str }
    end

  end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.