Class: Unit::Types::Phone

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/types/phone.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(country_code, number) ⇒ Phone

Returns a new instance of Phone.

Parameters:

  • country_code (String)

    The country code

  • number (String)

    The number



10
11
12
13
# File 'lib/unit/types/phone.rb', line 10

def initialize(country_code, number)
  @country_code = country_code
  @number = number
end

Instance Attribute Details

#country_codeObject (readonly)

Returns the value of attribute country_code.



6
7
8
# File 'lib/unit/types/phone.rb', line 6

def country_code
  @country_code
end

#numberObject (readonly)

Returns the value of attribute number.



6
7
8
# File 'lib/unit/types/phone.rb', line 6

def number
  @number
end

Instance Method Details

#representObject



15
16
17
18
19
20
# File 'lib/unit/types/phone.rb', line 15

def represent
  {
    countryCode: country_code,
    number: number
  }
end