useful_string_extensions 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -73,11 +73,11 @@ class String
73
73
  Russian.translit(self).downcase.gsub(/[^a-z0-9]+/, '-').strip.chomp('-')
74
74
 
75
75
  # другой вариант
76
- #initial = Russian::translit(self.name).gsub(/[^A-Za-z0-9\s\-]/, "")[0,40].strip.gsub(/\s+/, "-").downcase
76
+ # initial = Russian::translit(self.name).gsub(/[^A-Za-z0-9\s\-]/, "")[0,40].strip.gsub(/\s+/, "-").downcase
77
77
  end
78
78
 
79
79
  def to_search
80
- self.blank? ? "" : self.sanitize_to_sphinx.split_stars
80
+ self == "" ? "" : self.sanitize_to_sphinx.split_stars
81
81
  end
82
82
 
83
83
  def remove_stars
@@ -91,11 +91,11 @@ class String
91
91
  alias_method :generate_password, :generate_secret_code
92
92
 
93
93
  def sanitize_to_sphinx
94
- Unicode.downcase(self).gsub(/[^a-zа-яёЁ0-9\*]/, ' ').split("[")[0].split(" ").compact.join(" ")#.strip
94
+ self == "" ? "" : Unicode.downcase(self).gsub(/[^a-zа-яёЁ0-9\*]/, ' ').split("[")[0].split(" ").compact.join(" ")
95
95
  end
96
96
 
97
97
  def split_stars
98
- self.sanitize_to_sphinx.split(" ").collect {|w| "*#{w}*" if w.size > 2}.join(" ")
98
+ self == "" ? "" : self.split(" ").collect {|w| "*#{w}*" if w.size > 2}.join(" ")
99
99
  end
100
100
 
101
101
  def end_stars
@@ -1,3 +1,3 @@
1
1
  module UsefulStringExtensions
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
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.12
4
+ version: 0.0.13
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-03 00:00:00.000000000 Z
12
+ date: 2013-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chardet