Class: Twizo::Params
- Inherits:
-
Object
show all
- Defined in:
- lib/twizo/modules/params/params.rb
Instance Method Summary
collapse
Instance Method Details
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/twizo/modules/params/params.rb', line 23
def format_input(attributes)
attributes.map do |attribute|
attribute.gsub!(/[()+o ]/, '()+ ' => '', 'o' => '0')
attribute.gsub!(/^0+/, '')
unless attribute.scan(/\D/).empty?
raise TwizoError.new(422, 'The number(s) may not contain any characters.')
end
end
attributes
end
|
12
13
14
15
16
|
# File 'lib/twizo/modules/params/params.rb', line 12
def format_to_array(attributes)
attributes.kind_of?(Array) ? attributes_array = attributes : attributes_array = [attributes]
attributes.nil? ? attributes : format_input(attributes_array)
end
|