degermatize 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -18,13 +18,27 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- str = "Rüben füttern die Ärmsten".degermatize
22
- # => "Rueben fuettern die Aermsten"
23
- # str => "Rüben füttern die Ärmsten"
21
+ str = "Rüben füttern die Ärmsten"
24
22
 
25
- str = "Rüben füttern die Ärmsten".degermatize!
26
- # => "Rueben fuettern die Aermsten"
27
- # str => "Rueben fuettern die Aermsten"
23
+ str.degermatize
24
+
25
+ => "Rueben fuettern die Aermsten"
26
+
27
+ str => "Rüben füttern die Ärmsten"
28
+
29
+
30
+
31
+ (with bang! Instant replacement)
32
+
33
+ str = "Rüben füttern die Ärmsten"
34
+
35
+ str.degermatize!
36
+
37
+
38
+ => "Rueben fuettern die Aermsten"
39
+
40
+ str => "Rueben fuettern die Aermsten"
41
+
28
42
 
29
43
 
30
44
 
@@ -2,10 +2,10 @@
2
2
  require File.expand_path('../lib/degermatize/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.authors = ["Nikolai Manek"]
6
- gem.email = ["niko.manek@gmail.com"]
7
- gem.description = ["This gem adds the degermatize and degermatize! methods to String objects. It replaces German umlauts like \"üäöÄÖÜß\" with a ASCII representation."]
8
- gem.summary = ["This gem adds the degermatize and degermatize! methods to String objects. It replaces German umlauts like \"üäöÄÖÜß\" with a ASCII representation."]
5
+ gem.authors = "Nikolai Manek"
6
+ gem.email = "niko.manek@gmail.com"
7
+ gem.description = "This gem adds the degermatize and degermatize! methods to String objects. It replaces German umlauts like \"üäöÄÖÜß\" with a ASCII representation."
8
+ gem.summary = "This gem adds the degermatize and degermatize! methods to String objects. It replaces German umlauts like \"üäöÄÖÜß\" with a ASCII representation."
9
9
  gem.homepage = ""
10
10
 
11
11
  gem.files = `git ls-files`.split($\)
@@ -1,17 +1,15 @@
1
1
  # -*- encoding: utf-8 -*-
2
-
3
2
  require "degermatize/version"
4
3
  class String
5
- def degermatize
6
- dict = { 'ä' => 'ae', 'ü' => 'ue', 'ö' => 'oe','Ä' => 'Ae','Ö' => 'Oe','Ü' => 'Ue', 'ß' => 'ss' }
4
+ @@dict = { 'ä' => 'ae', 'ü' => 'ue', 'ö' => 'oe','Ä' => 'Ae','Ö' => 'Oe','Ü' => 'Ue', 'ß' => 'ss' }
5
+ def degermatize
7
6
  self.gsub /[üäöÄßÖÜ]/ do |match|
8
- dict[match.to_s]
7
+ @@dict[match.to_s]
9
8
  end
10
9
  end
11
10
  def degermatize!
12
- dict = { 'ä' => 'ae', 'ü' => 'ue', 'ö' => 'oe','Ä' => 'Ae','Ö' => 'Oe','Ü' => 'Ue', 'ß' => 'ss' }
13
11
  self.gsub! /[üäöÄßÖÜ]/ do |match|
14
- dict[match.to_s]
12
+ @@dict[match.to_s]
15
13
  end
16
14
  end
17
15
  end
@@ -1,3 +1,3 @@
1
1
  module Degermatize
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'test_helper'
3
+ require 'degermatize'
4
+
5
+ class DegermatizeTest < Test::Unit::TestCase
6
+
7
+ def test_replacing_umlauts
8
+ str = "üäöÄßÖÜ"
9
+ assert_equal str.degermatize, "ueaeoeAessOeUe"
10
+ assert_equal str, "üäöÄßÖÜ"
11
+ end
12
+ def test_replacing_umlauts_permanently
13
+ str = "üäöÄßÖÜ"
14
+ assert_equal str.degermatize!, "ueaeoeAessOeUe"
15
+ assert_equal str, "ueaeoeAessOeUe"
16
+ end
17
+
18
+ end
@@ -0,0 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require 'rubygems'
4
+ require 'test/unit'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: degermatize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-20 00:00:00.000000000 Z
12
+ date: 2012-05-21 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: ! '["This gem adds the degermatize and degermatize! methods to String
15
- objects. It replaces German umlauts like \"üäöÄÖÜß\" with a ASCII representation."]'
16
- email:
17
- - niko.manek@gmail.com
14
+ description: This gem adds the degermatize and degermatize! methods to String objects.
15
+ It replaces German umlauts like "üäöÄÖÜß" with a ASCII representation.
16
+ email: niko.manek@gmail.com
18
17
  executables: []
19
18
  extensions: []
20
19
  extra_rdoc_files: []
@@ -27,6 +26,8 @@ files:
27
26
  - degermatize.gemspec
28
27
  - lib/degermatize.rb
29
28
  - lib/degermatize/version.rb
29
+ - test/degermatize_test.rb
30
+ - test/test_helper.rb
30
31
  homepage: ''
31
32
  licenses: []
32
33
  post_install_message:
@@ -50,6 +51,8 @@ rubyforge_project:
50
51
  rubygems_version: 1.8.10
51
52
  signing_key:
52
53
  specification_version: 3
53
- summary: ! '["This gem adds the degermatize and degermatize! methods to String objects.
54
- It replaces German umlauts like \"üäöÄÖÜß\" with a ASCII representation."]'
55
- test_files: []
54
+ summary: This gem adds the degermatize and degermatize! methods to String objects.
55
+ It replaces German umlauts like "üäöÄÖÜß" with a ASCII representation.
56
+ test_files:
57
+ - test/degermatize_test.rb
58
+ - test/test_helper.rb