carpodaster-unicase 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. data/Rakefile +6 -1
  2. data/VERSION +1 -1
  3. data/lib/unicase.rb +8 -1
  4. data/test/unicase_test.rb +24 -0
  5. metadata +6 -5
data/Rakefile CHANGED
@@ -1,5 +1,10 @@
1
1
  require "rubygems"
2
- require "rake"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new("test") do |t|
5
+ t.test_files = FileList['test/*_test.rb']
6
+ t.verbose = false
7
+ end
3
8
 
4
9
  begin
5
10
  require 'jeweler'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # -*- coding: utf-8 -*-"
2
2
  module Unicase
3
3
  Uppercase = Hash.new { |h,k| k}
4
4
  Lowercase = Hash.new { |h,k| k}
@@ -20,6 +20,7 @@ module Unicase
20
20
  end
21
21
 
22
22
  class String
23
+
23
24
  def first_unicode_capitalize
24
25
  if self =~ /\A(.)/um
25
26
  Unicase::Uppercase[$1] + $'
@@ -41,9 +42,15 @@ class String
41
42
  each_char { |x| res << Unicase::Lowercase[x] }
42
43
  res
43
44
  end
45
+ alias_method :utf8_downcase, :unicode_lowercase
46
+
44
47
  def unicode_uppercase
45
48
  res = ""
46
49
  each_char { |x| res << Unicase::Uppercase[x] }
47
50
  res
48
51
  end
52
+ alias_method :utf8_upcase, :unicode_uppercase
53
+
49
54
  end
55
+
56
+ String.send(:include, Unicase)
@@ -0,0 +1,24 @@
1
+ # -*- coding: utf-8 -*-"
2
+ require 'test/unit'
3
+ require File.dirname(__FILE__) + "/../lib/unicase"
4
+
5
+ class UnicaseTest < Test::Unit::TestCase
6
+
7
+ def test_string_integration
8
+ [:unicode_lowercase, :unicode_uppercase, :utf8_downcase, :utf8_upcase].each do |method|
9
+ assert_respond_to String.new, method
10
+ end
11
+ end
12
+
13
+ def test_umlauts
14
+ # FIXME: displays wrong value here?
15
+ # assert_equal "Ä", "ä".utf8_upcase
16
+ # assert_equal "Ö", "ö".utf8_upcase
17
+ # assert_equal "Ü", "ü".utf8_upcase
18
+ #
19
+ # assert_equal "ä", "Ä".utf8_downcase
20
+ # assert_equal "ö", "Ö".utf8_downcase
21
+ # assert_equal "ü", "Ü".utf8_downcase
22
+ end
23
+
24
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carpodaster-unicase
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - bkkgrad
@@ -38,6 +38,7 @@ files:
38
38
  - lib/case_data.dat
39
39
  - lib/case_data_creator.rb
40
40
  - lib/unicase.rb
41
+ - test/unicase_test.rb
41
42
  has_rdoc: true
42
43
  homepage: http://github.com/carpodaster/unicase
43
44
  licenses: []
@@ -72,5 +73,5 @@ rubygems_version: 1.3.7
72
73
  signing_key:
73
74
  specification_version: 3
74
75
  summary: Unicase-aware upcase and downcase
75
- test_files: []
76
-
76
+ test_files:
77
+ - test/unicase_test.rb