Skip to content

Instantly share code, notes, and snippets.

@taf2
Created February 11, 2013 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taf2/4754606 to your computer and use it in GitHub Desktop.
Save taf2/4754606 to your computer and use it in GitHub Desktop.
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
@floere
Copy link

floere commented Feb 11, 2013

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment