useful_string_extensions 0.0.13 → 0.0.14

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.
@@ -114,10 +114,6 @@ class String
114
114
  self.blank? ? "" : self.gsub('"', "'")
115
115
  end
116
116
 
117
- def is_valid_email?
118
- !(self =~ CustomEmailValidator.email_regex).nil?
119
- end
120
-
121
117
  def to_page_slug
122
118
  self.gsub(/^\//, '').gsub(".html", "")
123
119
  end
@@ -125,4 +121,26 @@ class String
125
121
  def valide_of_email?
126
122
  self =~ /(^$)|(^[a-z0-9]+([_\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\.[a-z]{2,}$)/
127
123
  end
124
+
125
+ def is_valid_email?
126
+ !(self =~ CustomEmailValidator.email_regex).nil?
127
+ end
128
+
129
+ def is_valid_phone_from_russia?
130
+ !(self =~ CustomPhoneValidator.russian_phone_regex).nil?
131
+ end
132
+
133
+ def normalize_phone
134
+ self == "" ? "" : self.gsub(/\D+/,'')
135
+ end
136
+
137
+ def to_clean
138
+ allowed_tags = {
139
+ :elements => %w[p a ul ol li u],
140
+ :attributes => {'a' => ['href', 'title']},
141
+ :protocols => {'a' => {'href' => ['http', 'https', 'mailto']}}
142
+ }
143
+ self == "" ? "" : Sanitize.clean(self, allowed_tags)
144
+ end
145
+
128
146
  end
@@ -1,3 +1,3 @@
1
1
  module UsefulStringExtensions
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: useful_string_extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-08 00:00:00.000000000 Z
12
+ date: 2013-07-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chardet
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  requirements: []
97
97
  rubyforge_project:
98
- rubygems_version: 1.8.23
98
+ rubygems_version: 1.8.19
99
99
  signing_key:
100
100
  specification_version: 3
101
101
  summary: useful_string_extensions