I have a module that generates a phone number in the format I need.
module PhoneNumber
def self.prefix
'+'
end
def self.country
rand(1..9).to_s
end
def self.code
rand(100..999).to_s
end
def self.number
rand(1000000..9999999).to_s
end
end
I use it as follows.
Or as a formatted string "#{}#{}".
phone_number = PhoneNumber.prefix +
PhoneNumber.country +
PhoneNumber.code +
PhoneNumber.number
I want to rewrite the body of the module in this way, so that I can use it in a dotted format.
PhoneNumber.prefix.code.number