class Phony::NationalSplitters::None

This is a national splitter for countries which have no NDC / Area Code.

Public Class Methods

instance_for(*) click to toggle source

Get a splitter. Caches.

# File lib/phony/national_splitters/none.rb, line 12
def self.instance_for(*)
  @instance ||= new
end

Public Instance Methods

length() click to toggle source

A valid length.

# File lib/phony/national_splitters/none.rb, line 44
def length
  0
end
split(national_number) click to toggle source

On false:

This is a hack to make phony’s plausible method work even with this splitter.

Promise: We will rewrite this soon to beautify, but making it work for people in production is most important right now.

The problem is that the validation looks at whether there is a NDC - if it is nil, it is not plausible. (Does not work with this class, of course since using nil is dangerous and breaks abstraction)

Note: Actually, it might stay in.

TODO Flip nil/false?

# File lib/phony/national_splitters/none.rb, line 38
def split national_number
  [nil, false, national_number]
end