Class: Iso639::Language

Inherits:
Object
  • Object
show all
Defined in:
lib/iso639/language.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(alpha3_bibliographic, alpha3_terminology, alpha2, english_names, french_names) ⇒ Language

Public: Initialize a Language.

alpha3_bibliographic - A String representing the alpha-3 bibliographic code alpha3_terminology - A String representing the alpha-3 terminology code alpha2 - A String representing the alpha-2 code english_names - A String representing the English names (semi-colon delimited) french_names - A String representing the French names (semi-colon delimited)



13
14
15
16
17
18
19
# File 'lib/iso639/language.rb', line 13

def initialize(alpha3_bibliographic, alpha3_terminology, alpha2, english_names, french_names)
  @alpha3_bibliographic = strip_to_nil(alpha3_bibliographic)
  @alpha3_terminology   = strip_to_nil(alpha3_terminology) || @alpha3_bibliographic
  @alpha2               = strip_to_nil(alpha2)
  @english_names        = split_and_strip(english_names)
  @french_names         = split_and_strip(french_names)
end

Instance Attribute Details

#alpha2Object (readonly)

Returns the value of attribute alpha2.



3
4
5
# File 'lib/iso639/language.rb', line 3

def alpha2
  @alpha2
end

#alpha3_bibliographicObject (readonly) Also known as: alpha3

Returns the value of attribute alpha3_bibliographic.



3
4
5
# File 'lib/iso639/language.rb', line 3

def alpha3_bibliographic
  @alpha3_bibliographic
end

#alpha3_terminologyObject (readonly)

Returns the value of attribute alpha3_terminology.



3
4
5
# File 'lib/iso639/language.rb', line 3

def alpha3_terminology
  @alpha3_terminology
end

#english_namesObject (readonly)

Returns the value of attribute english_names.



3
4
5
# File 'lib/iso639/language.rb', line 3

def english_names
  @english_names
end

#french_namesObject (readonly)

Returns the value of attribute french_names.



3
4
5
# File 'lib/iso639/language.rb', line 3

def french_names
  @french_names
end

Instance Method Details

#english_nameObject Also known as: name, to_s



21
22
23
# File 'lib/iso639/language.rb', line 21

def english_name
  english_names.first
end

#french_nameObject



27
28
29
# File 'lib/iso639/language.rb', line 27

def french_name
  french_names.first
end