objects_extensions 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/string_extensions.rb +7 -4
- data/objects_extensions.gemspec +4 -4
- metadata +11 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/string_extensions.rb
CHANGED
@@ -35,8 +35,9 @@ String.class_eval do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
# Replaces all \n or \r\n for <br />
|
38
|
-
def html_text
|
39
|
-
self.gsub(/\<(.| )*\>/,'')
|
38
|
+
def html_text(escape=true)
|
39
|
+
str_to_convert = escape.present? ? self.gsub(/\<(.| )*\>/,'') : self
|
40
|
+
str_to_convert.gsub(/\r/, '').gsub(/\n/, '<br />')
|
40
41
|
end
|
41
42
|
|
42
43
|
# Removes first num_chars from string
|
@@ -162,12 +163,14 @@ class String
|
|
162
163
|
# * :downcase => call downcase on the string (defaults to true)
|
163
164
|
# * :convert_spaces => Convert space to underscore (defaults to false)
|
164
165
|
# * :regexp => The regexp matching characters that will be converting to an empty string (defaults to /[^-_A-Za-z0-9]/)
|
166
|
+
# * :removeaccents => If want to remove accents from String, defaults to true
|
165
167
|
def urlize(options = {})
|
166
168
|
options[:downcase] ||= true
|
167
|
-
options[:convert_spaces] ||=
|
169
|
+
options[:convert_spaces] ||= true
|
170
|
+
options[:removeaccents] ||= true
|
168
171
|
options[:regexp] ||= /[^-_A-Za-z0-9]/
|
169
172
|
|
170
|
-
str = self.strip.removeaccents
|
173
|
+
str = options[:removeaccents].present? ? self.removeaccents.strip.removeaccents : self.strip
|
171
174
|
str.downcase! if options[:downcase]
|
172
175
|
str.gsub!(/\ /,'_') if options[:convert_spaces]
|
173
176
|
str.gsub(options[:regexp], '')
|
data/objects_extensions.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{objects_extensions}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["jduarte"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-07-12}
|
13
13
|
s.description = %q{Convenience Methods}
|
14
14
|
s.email = %q{jose.fduarte@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
s.homepage = %q{http://github.com/jduarte/objects_extensions}
|
36
36
|
s.rdoc_options = ["--charset=UTF-8"]
|
37
37
|
s.require_paths = ["lib"]
|
38
|
-
s.rubygems_version = %q{1.3.
|
38
|
+
s.rubygems_version = %q{1.3.7}
|
39
39
|
s.summary = %q{Some convenient methods to String and Hash}
|
40
40
|
s.test_files = [
|
41
41
|
"test/helper.rb",
|
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
|
|
46
46
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
47
47
|
s.specification_version = 3
|
48
48
|
|
49
|
-
if Gem::Version.new(Gem::
|
49
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
50
50
|
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
51
51
|
else
|
52
52
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: objects_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
+
- 2
|
8
9
|
- 0
|
9
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- jduarte
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-07-12 00:00:00 +01:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: thoughtbot-shoulda
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
version: "0"
|
@@ -63,23 +66,27 @@ rdoc_options:
|
|
63
66
|
require_paths:
|
64
67
|
- lib
|
65
68
|
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
66
70
|
requirements:
|
67
71
|
- - ">="
|
68
72
|
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
69
74
|
segments:
|
70
75
|
- 0
|
71
76
|
version: "0"
|
72
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
73
79
|
requirements:
|
74
80
|
- - ">="
|
75
81
|
- !ruby/object:Gem::Version
|
82
|
+
hash: 3
|
76
83
|
segments:
|
77
84
|
- 0
|
78
85
|
version: "0"
|
79
86
|
requirements: []
|
80
87
|
|
81
88
|
rubyforge_project:
|
82
|
-
rubygems_version: 1.3.
|
89
|
+
rubygems_version: 1.3.7
|
83
90
|
signing_key:
|
84
91
|
specification_version: 3
|
85
92
|
summary: Some convenient methods to String and Hash
|