namecase 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,12 @@
1
+ = NameCase CHANGELOG
2
+
3
+ == 1.0.2
4
+
5
+ * Updating NameCase to work with the new Edge Rails ActiveSupport::Multibye
6
+ class. Thanks Dan Kubb (dan.kubb@autopilotmarketing.com)
7
+ * Converted to Hoe.
8
+
9
+ == 1.0.0
10
+
11
+ * Initial release
12
+
File without changes
@@ -1,14 +1,18 @@
1
- == NameCase
1
+ = NameCase
2
2
 
3
- Version 1.0.0 - 2005/11/2
3
+ http://namecase.rubyforge.org/
4
4
 
5
- Original version by Mark Summerfield <http://search.cpan.org/~summer/>
6
- Ruby port by Aaron Patterson <aaronp@rubyforge.org>
5
+ Version 1.0.2 - 2006/10/24
6
+
7
+ == DESCRIPTION
7
8
 
8
9
  NameCase is a Ruby implementation of Lingua::EN::NameCase, a library for
9
- converting strings to be properly cased. This is good for converting
10
+ converting strings to be properly cased. This is good for converting
10
11
  denormalized data to human friendly data.
11
12
 
13
+ Original version by Mark Summerfield <http://search.cpan.org/~summer/>
14
+ Ruby port by Aaron Patterson <aaronp@rubyforge.org>
15
+
12
16
  * Example Usage
13
17
 
14
18
  NameCase is a subclass of Ruby's +String+, and can be used similarly:
@@ -31,9 +35,8 @@ Copyright (c) Mark Summerfield 1998-2002.
31
35
  All Rights Reserved
32
36
 
33
37
  Ruby Version:
34
- Copyright (c) Aaron Patterson 2005
38
+ Copyright (c) Aaron Patterson 2006
35
39
 
36
40
  * License
37
41
 
38
42
  NameCase is distributed under the GPL license. Please see the LICENSE file.
39
-
@@ -4,9 +4,15 @@ class NameCase < String
4
4
 
5
5
  # Returns a new +String+ with the contents properly namecased
6
6
  def nc
7
- localstring = self.downcase
8
- localstring.gsub!(/\b\w/) { |first| first.upcase }
9
- localstring.gsub!("\'\w\b") { |c| c.downcase } # Lowercase 's
7
+ if respond_to?(:chars)
8
+ localstring = chars.downcase.to_s
9
+ localstring.gsub!(/\b\w/) { |first| first.chars.upcase }
10
+ localstring.gsub!(/\'\w\b/) { |c| c.chars.downcase } # Lowercase 's
11
+ else
12
+ localstring = downcase
13
+ localstring.gsub!(/\b\w/) { |first| first.upcase }
14
+ localstring.gsub!(/\'\w\b/) { |c| c.downcase } # Lowercase 's
15
+ end
10
16
 
11
17
  if localstring =~ /\bMac[A-Za-z]{2,}[^aciozj]\b/ or localstring =~ /\bMc/
12
18
  localstring.gsub!(/\b(Ma?c)([A-Za-z]+)/) { |match| $1 + $2.capitalize }
@@ -1,5 +1,3 @@
1
- # DO NOT EDIT
2
- # This file is auto-generated by build scripts
3
1
  class NameCase < String
4
- Version = '1.0.1'
2
+ Version = '1.0.2'
5
3
  end
@@ -0,0 +1,2 @@
1
+ require 'test/unit'
2
+ require 'test_namecase'
@@ -9,10 +9,10 @@ class TestNameCase < Test::Unit::TestCase
9
9
  @proper_names = [
10
10
  "Keith", "Leigh-Williams", "McCarthy",
11
11
  "O'Callaghan", "St. John", "von Streit",
12
- "van Dyke", "Van", "ap Llwyd Dafydd",
13
- "al Fahd", "Al",
12
+ "van Dyke", "Van", "ap Llwyd Dafydd",
13
+ "al Fahd", "Al",
14
14
  "el Grecco",
15
- "ben Gurion", "Ben",
15
+ "ben Gurion", "Ben",
16
16
  "da Vinci",
17
17
  "di Caprio", "du Pont", "de Legate",
18
18
  "del Crond", "der Sind", "van der Post",
@@ -42,4 +42,16 @@ class TestNameCase < Test::Unit::TestCase
42
42
  assert_equal(name, nc_name.downcase.nc!)
43
43
  end
44
44
  end
45
+
46
+ def test_namecase_multibyte
47
+ String.class_eval { define_method(:chars) { self } }
48
+
49
+ $KCODE = 'u'
50
+
51
+ proper_cased = 'Iñtërnâtiônàlizætiøn'
52
+ nc_name = NameCase.new(proper_cased)
53
+ assert_equal(proper_cased, nc_name.downcase.nc!)
54
+
55
+ String.class_eval { undef_method :chars }
56
+ end
45
57
  end
metadata CHANGED
@@ -1,18 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.11
2
+ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: namecase
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.1
7
- date: 2006-05-16 00:00:00 -07:00
6
+ version: 1.0.2
7
+ date: 2006-11-04 00:00:00 -08:00
8
8
  summary: "NameCase is a Ruby implementation of Lingua::EN::NameCase, a library for
9
9
  converting strings to be properly cased."
10
10
  require_paths:
11
11
  - lib
12
+ - test
12
13
  email: aaronp@rubyforge.org
13
- homepage: namecase.rubyforge.org
14
+ homepage: http://namecase.rubyforge.org/
14
15
  rubyforge_project: namecase
15
- description:
16
+ description: "NameCase is a Ruby implementation of Lingua::EN::NameCase, a library for
17
+ converting strings to be properly cased. This is good for converting
18
+ denormalized data to human friendly data."
16
19
  autorequire:
17
20
  default_executable:
18
21
  bindir: bin
@@ -27,26 +30,32 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
27
30
  platform: ruby
28
31
  signing_key:
29
32
  cert_chain:
33
+ post_install_message:
30
34
  authors:
31
35
  - Aaron Patterson
32
36
  files:
33
- - test/test_namecase.rb
37
+ - README.txt
38
+ - CHANGELOG.txt
39
+ - LICENSE.txt
34
40
  - lib/namecase.rb
35
41
  - lib/version.rb
36
- - README
37
- - CHANGELOG
38
- - LICENSE
39
- test_files: []
40
- rdoc_options:
41
- - "--main"
42
- - README
43
- - "--title"
44
- - "'NameCase RDoc'"
45
- extra_rdoc_files:
46
- - README
47
- - CHANGELOG
48
- - LICENSE
42
+ test_files:
43
+ - test/test_all.rb
44
+ - test/test_namecase.rb
45
+ - test/test_all.rb
46
+ rdoc_options: []
47
+ extra_rdoc_files: []
49
48
  executables: []
50
49
  extensions: []
51
50
  requirements: []
52
- dependencies: []
51
+ dependencies:
52
+ - !ruby/object:Gem::Dependency
53
+ name: hoe
54
+ version_requirement:
55
+ version_requirements: !ruby/object:Gem::Version::Requirement
56
+ requirements:
57
+ -
58
+ - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 1.1.2
61
+ version:
data/CHANGELOG DELETED
@@ -1,4 +0,0 @@
1
- *1.0.0*
2
-
3
- * Initial release
4
-