Class: ITU::E164::Result

Inherits:
Data
  • Object
show all
Defined in:
lib/itu/e164/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#canonicalObject (readonly)

Returns the value of attribute canonical

Returns:

  • (Object)

    the current value of canonical



5
6
7
# File 'lib/itu/e164/result.rb', line 5

def canonical
  @canonical
end

#categoryObject (readonly)

Returns the value of attribute category

Returns:

  • (Object)

    the current value of category



5
6
7
# File 'lib/itu/e164/result.rb', line 5

def category
  @category
end

#country_codeObject (readonly)

Returns the value of attribute country_code

Returns:

  • (Object)

    the current value of country_code



5
6
7
# File 'lib/itu/e164/result.rb', line 5

def country_code
  @country_code
end

#dataset_versionObject (readonly)

Returns the value of attribute dataset_version

Returns:

  • (Object)

    the current value of dataset_version



5
6
7
# File 'lib/itu/e164/result.rb', line 5

def dataset_version
  @dataset_version
end

#digitsObject (readonly)

Returns the value of attribute digits

Returns:

  • (Object)

    the current value of digits



5
6
7
# File 'lib/itu/e164/result.rb', line 5

def digits
  @digits
end

#errorsObject (readonly)

Returns the value of attribute errors

Returns:

  • (Object)

    the current value of errors



5
6
7
# File 'lib/itu/e164/result.rb', line 5

def errors
  @errors
end

#inputObject (readonly)

Returns the value of attribute input

Returns:

  • (Object)

    the current value of input



5
6
7
# File 'lib/itu/e164/result.rb', line 5

def input
  @input
end

#national_numberObject (readonly)

Returns the value of attribute national_number

Returns:

  • (Object)

    the current value of national_number



5
6
7
# File 'lib/itu/e164/result.rb', line 5

def national_number
  @national_number
end

#profileObject (readonly)

Returns the value of attribute profile

Returns:

  • (Object)

    the current value of profile



5
6
7
# File 'lib/itu/e164/result.rb', line 5

def profile
  @profile
end

#standard_versionObject (readonly)

Returns the value of attribute standard_version

Returns:

  • (Object)

    the current value of standard_version



5
6
7
# File 'lib/itu/e164/result.rb', line 5

def standard_version
  @standard_version
end

Instance Method Details

#conformant?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/itu/e164/result.rb', line 17

def conformant?
  errors.empty?
end

#error_codesObject



25
26
27
# File 'lib/itu/e164/result.rb', line 25

def error_codes
  errors.map(&:code).freeze
end

#failure?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/itu/e164/result.rb', line 21

def failure?
  !conformant?
end

#to_hObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/itu/e164/result.rb', line 29

def to_h
  {
    input:,
    profile:,
    standard_version:,
    dataset_version:,
    digits:,
    canonical:,
    category:,
    country_code:,
    national_number:,
    conformant: conformant?,
    errors: errors.map(&:to_h)
  }
end