Class: Phony::NationalSplitters::None
- Defined in:
- lib/phony/national_splitters/none.rb
Overview
This is a national splitter for countries which have no NDC / Area Code.
Class Method Summary collapse
-
.instance_for ⇒ Object
Get a splitter.
Instance Method Summary collapse
-
#length ⇒ Object
A valid length.
-
#split(national_number) ⇒ Object
On false:.
Methods inherited from Default
Methods inherited from DSL
Class Method Details
.instance_for ⇒ Object
Get a splitter. Caches.
12 13 14 |
# File 'lib/phony/national_splitters/none.rb', line 12 def self.instance_for(*) @instance ||= new end |
Instance Method Details
#length ⇒ Object
A valid length.
42 43 44 |
# File 'lib/phony/national_splitters/none.rb', line 42 def length 0 end |
#split(national_number) ⇒ Object
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: Decided it stays in. When formatting, it’s turned into nil.
36 37 38 |
# File 'lib/phony/national_splitters/none.rb', line 36 def split national_number [nil, false, national_number] end |