README.rdoc in icu_name-0.1.2 vs README.rdoc in icu_name-0.1.3
- old
+ new
@@ -24,28 +24,34 @@
Capitalisation, white space and punctuation will all be automatically corrected:
robert.name # => 'Robert J. Fischer'
robert.rname # => 'Fischer, Robert J.' (reversed name)
-The input text, without any changes apart from white-space cleanup, is returned by the _original_ method:
+The input text, without any changes apart from white-space cleanup and the insertion of a comma
+(to separate the two names), is returned by the _original_ method:
- robert.original # => 'robert j FISHER'
+ robert.original # => 'FISCHER, robert j'
To avoid ambiguity when either the first or second names consist of multiple words, it is better to
supply the two separately, if known. However, the full name can be supplied alone to the constructor
-and a guess will be made as to the first and last names.
+and a guess will be made as to the first and last names (the last distinct word becomes the last name).
- bobby = ICU::Name.new(' bobby fischer ')
+ bobby = ICU::Name.new(' bobby fischer ')
bobby.first # => 'Bobby'
bobby.last # => 'Fischer'
+But in this case, since the names were not supplied separately, the _original_ text will not contain a comma:
+
+ bobby.original # => 'bobby fischer'
+
Names will match even if one is missing middle initials or if a nickname is used for one of the first names.
bobby.match('Robert J.', 'Fischer') # => true
-Note that the class is aware of only common nicknames (e.g. _Bobby_ and _Robert_, _Bill_ and _William_, etc), not all possibilities.
+Note that the class is aware of only common nicknames (e.g. _Bobby_ and _Robert_, _Bill_ and _William_, etc)
+and not all possibilities.
Supplying the _match_ method with strings is equivalent to instantiating a Name instance with the same
strings and then matching it. So, for example the following are equivalent:
robert.match('R.', 'Fischer') # => true
@@ -78,17 +84,17 @@
strings encoded in UTF-8, no matter what the input encoding.
eric = ICU::Name.new('éric'.encode("ISO-8859-1"), 'PRIÉ'.force_encoding("ASCII-8BIT"))
eric.rname # => "Prié, Éric"
eric.rname.encoding.name # => "UTF-8"
- eric.original # => "éric PRIÉ"
+ eric.original # => "PRIÉ, éric"
eric.original.encoding.name # => "UTF-8"
Accented letters can be transliterated into their US-ASCII counterparts by setting the
_chars_ option, which is available in all accessors. For example:
eric.rname(:chars => "US-ASCII") # => "Prie, Eric"
- eric.original(:chars => "US-ASCII") # => "eric PRIE"
+ eric.original(:chars => "US-ASCII") # => "PRIE, eric"
Also possible is the preservation of ISO-8859-1 characters, but the transliteration of
all other accented characters:
joe = Name.new('Józef', 'Żabiński')