useful_helpers 0.0.28 → 0.0.29
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.
@@ -10,8 +10,6 @@ require "useful_helpers/helpers/url_helper"
|
|
10
10
|
require "useful_helpers/helpers/text_helper"
|
11
11
|
require "useful_helpers/helpers/videos_helper"
|
12
12
|
|
13
|
-
require "untransliterate"
|
14
|
-
|
15
13
|
module UsefulHelpers
|
16
14
|
class Engine < ::Rails::Engine
|
17
15
|
isolate_namespace UsefulHelpers
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: useful_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.29
|
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-10-
|
12
|
+
date: 2013-10-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -77,7 +77,6 @@ files:
|
|
77
77
|
- config/locales/useful_helpers.ru.yml
|
78
78
|
- lib/useful_helpers.rb
|
79
79
|
- lib/useful_helpers/engine.rb
|
80
|
-
- lib/useful_helpers/helpers.rb
|
81
80
|
- lib/useful_helpers/helpers/browser_helper.rb
|
82
81
|
- lib/useful_helpers/helpers/buttons_helper.rb
|
83
82
|
- lib/useful_helpers/helpers/date_time_helper.rb
|
@@ -89,7 +88,6 @@ files:
|
|
89
88
|
- lib/useful_helpers/helpers/text_helper.rb
|
90
89
|
- lib/useful_helpers/helpers/url_helper.rb
|
91
90
|
- lib/useful_helpers/helpers/videos_helper.rb
|
92
|
-
- lib/useful_helpers/untransliterate.rb
|
93
91
|
- lib/useful_helpers/version.rb
|
94
92
|
- useful_helpers.gemspec
|
95
93
|
homepage: https://github.com/st-granat/useful_helpers
|
@@ -113,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
111
|
version: '0'
|
114
112
|
requirements: []
|
115
113
|
rubyforge_project:
|
116
|
-
rubygems_version: 1.8.
|
114
|
+
rubygems_version: 1.8.23
|
117
115
|
signing_key:
|
118
116
|
specification_version: 3
|
119
117
|
summary: Useful helpers methods for Good Rails App
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
require "useful_helpers/helpers/browser_helper"
|
3
|
-
require "useful_helpers/helpers/date_time_helper"
|
4
|
-
require "useful_helpers/helpers/formtastic_helper"
|
5
|
-
require "useful_helpers/helpers/paginate_helper"
|
6
|
-
require "useful_helpers/helpers/seo_helper"
|
7
|
-
require "useful_helpers/helpers/url_helper"
|
8
|
-
require "useful_helpers/helpers/text_helper"
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
module Untransliterate
|
4
|
-
RV_LOWER_SINGLE = {
|
5
|
-
"і"=>"i","ґ"=>"g","ё"=>"yo","№"=>"#","є"=>"e",
|
6
|
-
"ї"=>"yi","а"=>"a","б"=>"b",
|
7
|
-
"в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"zh",
|
8
|
-
"з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l",
|
9
|
-
"м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r",
|
10
|
-
"с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h",
|
11
|
-
"ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"'",
|
12
|
-
"ы"=>"y","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya",
|
13
|
-
}.invert
|
14
|
-
|
15
|
-
RV_LOWER_MULTI = {
|
16
|
-
# "ье"=>"ie",
|
17
|
-
# "ьё"=>"ie",
|
18
|
-
}.invert
|
19
|
-
|
20
|
-
RV_UPPER_SINGLE = {
|
21
|
-
"Ґ"=>"G","Ё"=>"YO","Є"=>"E","Ї"=>"YI","І"=>"I",
|
22
|
-
"А"=>"A","Б"=>"B","В"=>"V","Г"=>"G",
|
23
|
-
"Д"=>"D","Е"=>"E","Ж"=>"ZH","З"=>"Z","И"=>"I",
|
24
|
-
"Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N",
|
25
|
-
"О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T",
|
26
|
-
"У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH",
|
27
|
-
"Ш"=>"SH","Щ"=>"SCH","Ъ"=>"'","Ы"=>"Y","Ь"=>"",
|
28
|
-
"Э"=>"E","Ю"=>"YU","Я"=>"YA",
|
29
|
-
}.invert
|
30
|
-
|
31
|
-
RV_UPPER_MULTI = {
|
32
|
-
# "ЬЕ"=>"IE",
|
33
|
-
# "ЬЁ"=>"IE",
|
34
|
-
}.invert
|
35
|
-
|
36
|
-
RV_LOWER = (LOWER_SINGLE.merge(RV_LOWER_MULTI)).freeze
|
37
|
-
RV_UPPER = (UPPER_SINGLE.merge(RV_UPPER_MULTI)).freeze
|
38
|
-
RV_MULTI_KEYS = (LOWER_MULTI.merge(RV_UPPER_MULTI)).keys.sort_by {|s| s.length}.reverse.freeze
|
39
|
-
|
40
|
-
# Transliterate a string with russian characters
|
41
|
-
#
|
42
|
-
# Возвращает строку, в которой все буквы русского алфавита заменены на похожую по звучанию латиницу
|
43
|
-
def self.run(str)
|
44
|
-
chars = str.scan(%r{#{RV_MULTI_KEYS.join '|'}|\w|.})
|
45
|
-
|
46
|
-
result = ""
|
47
|
-
|
48
|
-
chars.each_with_index do |char, index|
|
49
|
-
if RV_UPPER.has_key?(char) && RV_LOWER.has_key?(chars[index+1])
|
50
|
-
# combined case
|
51
|
-
result << RV_UPPER[char].downcase.capitalize
|
52
|
-
elsif UPPER.has_key?(char)
|
53
|
-
result << RV_UPPER[char]
|
54
|
-
elsif LOWER.has_key?(char)
|
55
|
-
result << RV_LOWER[char]
|
56
|
-
else
|
57
|
-
result << char
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
result
|
62
|
-
end
|
63
|
-
end
|