string_utils 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,8 @@
1
+ # encoding: utf-8
1
2
  module StringUtils
2
3
  # Based on transliteration table from i18n v0.5.0
3
4
  TRANSLITERATIONS = {
4
- # Latin
5
+ # Latin
5
6
  "À" =>"A", "Á"=>"A", "Â"=>"A", "Ã"=>"A", "Ä"=>"A", "Å"=>"A", "Æ"=>"AE",
6
7
  "Ç" =>"C", "È"=>"E", "É"=>"E", "Ê"=>"E", "Ë"=>"E", "Ì"=>"I", "Í"=>"I",
7
8
  "Î" =>"I", "Ï"=>"I", "Ð"=>"D", "Ñ"=>"N", "Ò"=>"O", "Ó"=>"O", "Ô"=>"O",
@@ -1,3 +1,3 @@
1
1
  module StringUtils
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.7"
3
3
  end
data/lib/string_utils.rb CHANGED
@@ -1,13 +1,14 @@
1
- # -*- coding: utf-8 -*-
1
+ # encoding: utf-8
2
2
  if RUBY_VERSION < '1.9'
3
3
  $KCODE = "UTF8" if $KCODE == "NONE"
4
4
  require 'active_support/core_ext/string/multibyte'
5
5
  end
6
6
 
7
+ require 'active_support/core_ext/string/inflections'
7
8
  require 'string_utils/transliteration'
8
9
 
9
10
 
10
- # StringUtils is a library that provides various handy string manipulation methods
11
+ # StringUtils is a library that provides various handy string manipulation methods
11
12
  # Example usage:
12
13
  # * StringUtils.truncate("hello world", 10, "...") #=> "hello..."
13
14
  # * StringUtils.normalize_name "\302\240 Gran Via/Avda.de Asturias " #=> :Gran Via / Avda. de Asturias"
@@ -39,7 +40,7 @@ module StringUtils
39
40
  # Converts a string to a nicely readable URL
40
41
  # opts:
41
42
  # :default_replacement -- string to use for unknown characters (Default: "")
42
- # :whitespace_replacement -- string to use to replace whitespace+ (Default: "-")
43
+ # :whitespace_replacement -- string to use to replace whitespace+ (Default: "-")
43
44
  def urlify(string, opts = {})
44
45
  opts = {:whitespace_replacement => '-', :default_replacement => ""}.merge(opts)
45
46
  string = string.gsub(WHITESPACES, opts[:whitespace_replacement])
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: string_utils
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
4
  prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 6
10
- version: 1.0.6
5
+ version: 1.0.7
11
6
  platform: ruby
12
7
  authors:
13
8
  - Gleb Mazovetskiy
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-02-17 00:00:00 +01:00
13
+ date: 2011-04-11 00:00:00 +02:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -26,11 +21,6 @@ dependencies:
26
21
  requirements:
27
22
  - - ">="
28
23
  - !ruby/object:Gem::Version
29
- hash: 9
30
- segments:
31
- - 2
32
- - 3
33
- - 5
34
24
  version: 2.3.5
35
25
  type: :runtime
36
26
  version_requirements: *id001
@@ -42,9 +32,6 @@ dependencies:
42
32
  requirements:
43
33
  - - ">="
44
34
  - !ruby/object:Gem::Version
45
- hash: 3
46
- segments:
47
- - 0
48
35
  version: "0"
49
36
  type: :runtime
50
37
  version_requirements: *id002
@@ -56,11 +43,6 @@ dependencies:
56
43
  requirements:
57
44
  - - ">="
58
45
  - !ruby/object:Gem::Version
59
- hash: 15
60
- segments:
61
- - 2
62
- - 0
63
- - 0
64
46
  version: 2.0.0
65
47
  type: :development
66
48
  version_requirements: *id003
@@ -109,23 +91,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
91
  requirements:
110
92
  - - ">="
111
93
  - !ruby/object:Gem::Version
112
- hash: 3
113
- segments:
114
- - 0
115
94
  version: "0"
116
95
  required_rubygems_version: !ruby/object:Gem::Requirement
117
96
  none: false
118
97
  requirements:
119
98
  - - ">="
120
99
  - !ruby/object:Gem::Version
121
- hash: 3
122
- segments:
123
- - 0
124
100
  version: "0"
125
101
  requirements: []
126
102
 
127
103
  rubyforge_project: string_utils
128
- rubygems_version: 1.4.2
104
+ rubygems_version: 1.6.2
129
105
  signing_key:
130
106
  specification_version: 3
131
107
  summary: Provides useful string utils like "truncate to word"