citrusbyte-is_taggable 0.85 → 0.87

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 (3) hide show
  1. data/CHANGELOG +8 -0
  2. data/lib/is_taggable/string.rb +31 -0
  3. metadata +2 -2
data/CHANGELOG CHANGED
@@ -1,5 +1,9 @@
1
1
  is_taggable:
2
2
 
3
+ == 2008-01-22
4
+
5
+ * Fixed gem building problem, gem should build now
6
+
3
7
  == 2008-12-11
4
8
 
5
9
  * Added support for Rails 2.2.2 (new Multibyte::Chars handling for tag normalization)
@@ -8,6 +12,10 @@ is_taggable:
8
12
 
9
13
  * Forked and totally changed
10
14
 
15
+ == 2009-01-05
16
+
17
+ * Updated broken gemspec (thanks, mixr)
18
+
11
19
  acts-as-taggable-on:
12
20
 
13
21
  == 2008-07-17
@@ -0,0 +1,31 @@
1
+ # http://www.jroller.com/obie/tags/unicode
2
+ class String
3
+ class << self
4
+ def unpack(string)
5
+ return ActiveSupport::Multibyte::Chars.g_unpack(string).collect{ |c| c[0] } if ActiveSupport::Multibyte::Chars.respond_to?(:g_unpack)
6
+ string.split('').collect{ |c| c.chars[0] }
7
+ end
8
+ end
9
+
10
+ def to_ascii
11
+ # split in muti-byte aware fashion and translate characters over 127
12
+ # and dropping characters not in the translation hash
13
+ String.unpack(self).collect{ |c| (c <= 127) ? c.chr : translation_hash[c] }.join
14
+ end
15
+
16
+ protected
17
+ def translation_hash
18
+ @@translation_hash ||= setup_translation_hash
19
+ end
20
+
21
+ def setup_translation_hash
22
+ accented_chars = String.unpack("ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüý")
23
+ unaccented_chars = "AAAAAACEEEEIIIIDNOOOOOxOUUUUYaaaaaaceeeeiiiinoooooouuuuy".split('')
24
+
25
+ translation_hash = {}
26
+ accented_chars.each_with_index { |char, idx| translation_hash[char] = unaccented_chars[idx] }
27
+ translation_hash[String.unpack("Æ").first] = 'AE'
28
+ translation_hash[String.unpack("æ").first] = 'ae'
29
+ translation_hash
30
+ end
31
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: citrusbyte-is_taggable
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.85"
4
+ version: "0.87"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Alavi
@@ -29,7 +29,6 @@ files:
29
29
  - generators/is_taggable_migration
30
30
  - generators/is_taggable_migration/is_taggable_migration_generator.rb
31
31
  - generators/is_taggable_migration/templates
32
- - generators/is_taggable_migration/templates/add_users_migration.rb
33
32
  - generators/is_taggable_migration/templates/migration.rb
34
33
  - init.rb
35
34
  - lib/is_taggable.rb
@@ -38,6 +37,7 @@ files:
38
37
  - lib/is_taggable/tag_list.rb
39
38
  - lib/is_taggable/tagging.rb
40
39
  - lib/is_taggable/tags_helper.rb
40
+ - lib/is_taggable/string.rb
41
41
  - rails/init.rb
42
42
  - spec/is_taggable
43
43
  - spec/is_taggable/is_taggable_spec.rb