rutils 0.2.5 → 1.0.0
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.
- data/History.txt +9 -0
- data/Manifest.txt +22 -15
- data/README.txt +54 -41
- data/Rakefile.rb +9 -26
- data/TODO.txt +2 -3
- data/WHAT_HAS_CHANGED.txt +44 -0
- data/init.rb +20 -2
- data/lib/countries/countries.rb +1 -0
- data/lib/datetime/datetime.rb +1 -0
- data/lib/gilenson/bluecloth_extra.rb +7 -0
- data/lib/gilenson/gilenson.rb +39 -30
- data/lib/gilenson/helper.rb +34 -0
- data/lib/gilenson/maruku_extra.rb +19 -0
- data/lib/gilenson/rdiscount_extra.rb +7 -0
- data/lib/gilenson/redcloth_extra.rb +42 -0
- data/lib/integration/integration.rb +1 -11
- data/lib/integration/rails_date_helper_override.rb +103 -105
- data/lib/integration/rails_pre_filter.rb +1 -0
- data/lib/pluralizer/pluralizer.rb +14 -13
- data/lib/rutils.rb +15 -25
- data/lib/transliteration/bidi.rb +15 -72
- data/lib/transliteration/simple.rb +1 -0
- data/lib/transliteration/transliteration.rb +11 -9
- data/lib/version.rb +5 -0
- data/test/extras/integration_bluecloth.rb +13 -0
- data/test/extras/integration_maruku.rb +15 -0
- data/test/{test_rails_filter.rb → extras/integration_rails_filter.rb} +3 -1
- data/test/extras/integration_rails_gilenson_helpers.rb +80 -0
- data/test/{test_rails_helpers.rb → extras/integration_rails_helpers.rb} +15 -3
- data/test/extras/integration_rdiscount.rb +15 -0
- data/test/extras/integration_redcloth3.rb +18 -0
- data/test/extras/integration_redcloth4.rb +19 -0
- data/test/run_tests.rb +2 -2
- data/test/{t_datetime.rb → test_datetime.rb} +1 -2
- data/test/{t_gilenson.rb → test_gilenson.rb} +15 -6
- data/test/test_integration.rb +22 -0
- data/test/test_integration_flag.rb +18 -0
- data/test/{t_pluralize.rb → test_pluralize.rb} +3 -2
- data/test/{t_rutils_base.rb → test_rutils_base.rb} +1 -0
- data/test/test_transliteration.rb +53 -0
- metadata +35 -26
- data/lib/integration/blue_cloth_override.rb +0 -12
- data/lib/integration/red_cloth_four.rb +0 -24
- data/lib/integration/red_cloth_override.rb +0 -7
- data/lib/integration/red_cloth_three.rb +0 -25
- data/test/t_integration.rb +0 -46
- data/test/t_transliteration.rb +0 -109
- data/test/test_integration_bluecloth.rb +0 -17
- data/test/test_integration_redcloth3.rb +0 -31
- data/test/test_integration_redcloth4.rb +0 -31
@@ -0,0 +1,34 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# Включается на правах хелпера в Rails-приложение
|
3
|
+
module RuTils::Gilenson::Helper
|
4
|
+
|
5
|
+
# Возвращает текст обработанный Гиленсоном
|
6
|
+
def gilensize(text, options = {})
|
7
|
+
return "" if text.blank?
|
8
|
+
f = RuTils::Gilenson::Formatter.new
|
9
|
+
f.configure!(options)
|
10
|
+
f.process(text)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Возвращает текст обработанный Текстилем и Гиленсоном
|
14
|
+
# <i>Метод доступен только при включенном RedCloth</i>
|
15
|
+
def textilize(text)
|
16
|
+
return "" if text.blank?
|
17
|
+
if RuTils.overrides_enabled?
|
18
|
+
RuTils::Gilenson::RedClothExtra.new(text, [ :hard_breaks ]).to_html
|
19
|
+
else
|
20
|
+
super(text)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Возвращает текст с кодом Markdown превращенным в HTML, попутно обработанный Гиленсоном
|
25
|
+
# <i>Метод доступен только при наличии BlueCloth</i>.
|
26
|
+
def markdown(text)
|
27
|
+
return "" if text.blank?
|
28
|
+
if RuTils.overrides_enabled?
|
29
|
+
RuTils::Gilenson::BlueClothExtra.new(text).to_html
|
30
|
+
else
|
31
|
+
super(text)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# Maruku с поддержкой Gilenson
|
3
|
+
class RuTils::Gilenson::MarukuExtra < Maruku
|
4
|
+
def to_html(*anything)
|
5
|
+
suspended = super
|
6
|
+
|
7
|
+
# Return quotes to original state
|
8
|
+
[187, 171, 8220, 8221].map do |e|
|
9
|
+
suspended.gsub! /&\##{e};/, '"'
|
10
|
+
end
|
11
|
+
|
12
|
+
# Return spaces to original state
|
13
|
+
[160].map do |e|
|
14
|
+
suspended.gsub! /&\##{e};/, ' '
|
15
|
+
end
|
16
|
+
|
17
|
+
suspended.gilensize
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
if RedCloth.class == Module
|
3
|
+
# RedCloth 4 - частичная поддержка
|
4
|
+
class RuTils::Gilenson::RedClothExtra < RedCloth::TextileDoc
|
5
|
+
def to_html(*anything)
|
6
|
+
suspended = super(*anything)
|
7
|
+
|
8
|
+
# Return quotes to original state
|
9
|
+
[187, 171, 8220, 8221].map do |e|
|
10
|
+
suspended.gsub! /&\##{e};/, '"'
|
11
|
+
end
|
12
|
+
|
13
|
+
# Return spaces to original state
|
14
|
+
[160].map do |e|
|
15
|
+
suspended.gsub! /&\##{e};/, ' '
|
16
|
+
end
|
17
|
+
|
18
|
+
suspended.gilensize
|
19
|
+
end
|
20
|
+
end
|
21
|
+
else
|
22
|
+
# RedCloth 3 - RuTils выполняет перегрузку Textile Glyphs в RedCloth, перенося форматирование спецсимволов на Gilenson.
|
23
|
+
# Применять как стандартный RedCloth
|
24
|
+
# RuTils::Gilenson::RedClothExtra.new(some_text).to_html
|
25
|
+
class RuTils::Gilenson::RedClothExtra < RedCloth
|
26
|
+
# Этот метод в RedCloth при наличии Гиленсона становится заглушкой
|
27
|
+
def htmlesc(text, mode=0)
|
28
|
+
text
|
29
|
+
end
|
30
|
+
|
31
|
+
# А этот метод обрабатывает Textile Glyphs - ту самую типографицу.
|
32
|
+
# Вместо того чтобы влезать в чужие таблицы мы просто заменим Textile Glyphs на Gilenson - и все будут рады.
|
33
|
+
def pgl(text) #:nodoc:
|
34
|
+
# Подвешиваем пробелы в начале и в конце каждого блока. Тряпка требует чтобы эти пробелы приехали
|
35
|
+
# назад нетронутыми.
|
36
|
+
spaces = Array.new(2,'')
|
37
|
+
text.gsub!(/\A([\s]+)/) { spaces[0] = $1; '' }
|
38
|
+
text.gsub!(/(\s+)\Z/) { spaces[1] = $1; '' }
|
39
|
+
text.replace(spaces[0].to_s + RuTils::Gilenson::Formatter.new(text).to_html + spaces[1].to_s)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,11 +1 @@
|
|
1
|
-
|
2
|
-
# Вновь выполняет перегрузку. Делать это надо после того, как в программу импортированы
|
3
|
-
# другие модули.
|
4
|
-
def self.reload_integrations!
|
5
|
-
load File.dirname(__FILE__) + '/blue_cloth_override.rb'
|
6
|
-
load File.dirname(__FILE__) + '/red_cloth_override.rb'
|
7
|
-
load File.dirname(__FILE__) + '/rails_date_helper_override.rb'
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
RuTils::reload_integrations!
|
1
|
+
require File.dirname(__FILE__) + '/rails_date_helper_override' if defined?(ActionView)
|
@@ -1,129 +1,127 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
module Object::ActionView::Helpers::DateHelper
|
3
|
+
# Несколько хаков для корректной работы модуля с Rails 1.2--2.0 одновременно с Rails 2.1 и выше.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
# Хелперы DateHelper принимают параметр <tt>html_options</tt> (идет последним) начиная с Rails 2.1.
|
6
|
+
# Нужно понять, имеем ли мы дело с Rails 2.1+, для этого проверяем наличие классметода helper_modules у
|
7
|
+
# ActionView::Base, который появился как раз в версии 2.1.
|
8
|
+
DATE_HELPERS_RECEIVE_HTML_OPTIONS = ActionView::Base.respond_to?(:helper_modules) #:nodoc:
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
10
|
+
# В Rails Edge (2.1+) определяется <tt>Time.current</tt> для работы с временными зонами.
|
11
|
+
unless Time.respond_to? :current
|
12
|
+
class << ::Time # :nodoc:
|
13
|
+
def current; now; end
|
15
14
|
end
|
15
|
+
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
# Заменяет <tt>ActionView::Helpers::DateHelper::distance_of_time_in_words</tt> на русское сообщение.
|
25
|
-
#
|
26
|
-
# Целые числа интерпретируются как секунды.
|
27
|
-
# <tt>distance_of_time_in_words(50)</tt> возвращает "меньше минуты".
|
28
|
-
alias :stock_distance_of_time_in_words :distance_of_time_in_words
|
29
|
-
def distance_of_time_in_words(*args)
|
30
|
-
RuTils::overrides_enabled? ? RuTils::DateTime::distance_of_time_in_words(*args) : stock_distance_of_time_in_words
|
17
|
+
# В Rails Edge (2.1+) определяется <tt>Date.current</tt> для работы с временными зонами.
|
18
|
+
unless Date.respond_to? :current
|
19
|
+
class << ::Date # :nodoc:
|
20
|
+
def current; now; end
|
31
21
|
end
|
22
|
+
end
|
32
23
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
24
|
+
# Заменяет <tt>ActionView::Helpers::DateHelper::distance_of_time_in_words</tt> на русское сообщение.
|
25
|
+
#
|
26
|
+
# Целые числа интерпретируются как секунды.
|
27
|
+
# <tt>distance_of_time_in_words(50)</tt> возвращает "меньше минуты".
|
28
|
+
alias :stock_distance_of_time_in_words :distance_of_time_in_words
|
29
|
+
def distance_of_time_in_words(*args)
|
30
|
+
RuTils::overrides_enabled? ? RuTils::DateTime::distance_of_time_in_words(*args) : stock_distance_of_time_in_words
|
31
|
+
end
|
32
|
+
|
33
|
+
# Заменяет ActionView::Helpers::DateHelper::select_month меню выбора русских месяцев.
|
34
|
+
#
|
35
|
+
# select_month(Date.today) # Использует ключи "Январь", "Март"
|
36
|
+
# select_month(Date.today, :use_month_numbers => true) # Использует ключи "1", "3"
|
37
|
+
# select_month(Date.today, :add_month_numbers => true) # Использует ключи "1 - Январь", "3 - Март"
|
38
|
+
def select_month(date, options = {}, html_options = {})
|
39
|
+
locale = options[:locale] unless RuTils::overrides_enabled?
|
40
|
+
|
41
|
+
val = date ? (date.kind_of?(Fixnum) ? date : date.month) : ''
|
42
|
+
if options[:use_hidden]
|
43
|
+
if self.class.private_instance_methods.include? "_date_hidden_html"
|
44
|
+
_date_hidden_html(options[:field_name] || 'month', val, options)
|
45
|
+
else
|
46
|
+
hidden_html(options[:field_name] || 'month', val, options)
|
47
|
+
end
|
48
|
+
else
|
49
|
+
month_options = []
|
50
|
+
if RuTils::overrides_enabled?
|
51
|
+
month_names = case true
|
52
|
+
when options[:use_short_month]
|
53
|
+
Date::RU_ABBR_MONTHNAMES
|
54
|
+
# использование в контексте date_select с днями требует родительный падеж
|
55
|
+
when options[:order] && options[:order].include?(:day)
|
56
|
+
Date::RU_INFLECTED_MONTHNAMES
|
57
|
+
else
|
58
|
+
Date::RU_MONTHNAMES
|
47
59
|
end
|
48
60
|
else
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
Date::RU_ABBR_MONTHNAMES
|
54
|
-
# использование в контексте date_select с днями требует родительный падеж
|
55
|
-
when options[:order] && options[:order].include?(:day)
|
56
|
-
Date::RU_INFLECTED_MONTHNAMES
|
57
|
-
else
|
58
|
-
Date::RU_MONTHNAMES
|
61
|
+
if defined? I18n
|
62
|
+
month_names = options[:use_month_names] || begin
|
63
|
+
key = options[:use_short_month] ? :'date.abbr_month_names' : :'date.month_names'
|
64
|
+
I18n.translate key, :locale => locale
|
59
65
|
end
|
60
66
|
else
|
61
|
-
|
62
|
-
month_names = options[:use_month_names] || begin
|
63
|
-
key = options[:use_short_month] ? :'date.abbr_month_names' : :'date.month_names'
|
64
|
-
I18n.translate key, :locale => locale
|
65
|
-
end
|
66
|
-
else
|
67
|
-
month_names = options[:use_short_month] ? Date::ABBR_MONTHNAMES : Date::MONTHNAMES
|
68
|
-
end
|
67
|
+
month_names = options[:use_short_month] ? Date::ABBR_MONTHNAMES : Date::MONTHNAMES
|
69
68
|
end
|
70
|
-
|
69
|
+
end
|
70
|
+
month_names.unshift(nil) if month_names.size < 13
|
71
71
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
else
|
78
|
-
month_names[month_number]
|
79
|
-
end
|
80
|
-
|
81
|
-
month_options << ((val == month_number) ?
|
82
|
-
content_tag(:option, month_name, :value => month_number, :selected => "selected") :
|
83
|
-
content_tag(:option, month_name, :value => month_number)
|
84
|
-
)
|
85
|
-
month_options << "\n"
|
86
|
-
end
|
87
|
-
|
88
|
-
if DATE_HELPERS_RECEIVE_HTML_OPTIONS
|
89
|
-
if self.class.private_instance_methods.include? "_date_select_html"
|
90
|
-
_date_select_html(options[:field_name] || 'month', month_options.join, options, html_options)
|
91
|
-
else
|
92
|
-
select_html(options[:field_name] || 'month', month_options.join, options, html_options)
|
93
|
-
end
|
72
|
+
1.upto(12) do |month_number|
|
73
|
+
month_name = if options[:use_month_numbers]
|
74
|
+
month_number
|
75
|
+
elsif options[:add_month_numbers]
|
76
|
+
month_number.to_s + ' - ' + month_names[month_number]
|
94
77
|
else
|
95
|
-
|
78
|
+
month_names[month_number]
|
96
79
|
end
|
80
|
+
|
81
|
+
month_options << ((val == month_number) ?
|
82
|
+
content_tag(:option, month_name, :value => month_number, :selected => "selected") :
|
83
|
+
content_tag(:option, month_name, :value => month_number)
|
84
|
+
)
|
85
|
+
month_options << "\n"
|
97
86
|
end
|
98
|
-
|
99
|
-
|
100
|
-
alias :stock_select_date :select_date
|
101
|
-
# Заменяет ActionView::Helpers::DateHelper::select_date меню выбора русской даты.
|
102
|
-
def select_date(date = Date.current, options = {}, html_options = {})
|
103
|
-
options[:order] ||= [:day, :month, :year]
|
87
|
+
|
104
88
|
if DATE_HELPERS_RECEIVE_HTML_OPTIONS
|
105
|
-
|
89
|
+
if self.class.private_instance_methods.include? "_date_select_html"
|
90
|
+
_date_select_html(options[:field_name] || 'month', month_options.join, options, html_options)
|
91
|
+
else
|
92
|
+
select_html(options[:field_name] || 'month', month_options.join, options, html_options)
|
93
|
+
end
|
106
94
|
else
|
107
|
-
|
95
|
+
select_html(options[:field_name] || 'month', month_options.join, options)
|
108
96
|
end
|
109
97
|
end
|
110
98
|
end
|
111
99
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
100
|
+
alias :stock_select_date :select_date
|
101
|
+
# Заменяет ActionView::Helpers::DateHelper::select_date меню выбора русской даты.
|
102
|
+
def select_date(date = Date.current, options = {}, html_options = {})
|
103
|
+
options[:order] ||= [:day, :month, :year]
|
104
|
+
if DATE_HELPERS_RECEIVE_HTML_OPTIONS
|
105
|
+
stock_select_date(date, options, html_options)
|
106
|
+
else
|
107
|
+
stock_select_date(date, options)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
module Object::ActionView::Helpers
|
113
|
+
if defined?(InstanceTag) && InstanceTag.private_method_defined?(:date_or_time_select)
|
114
|
+
class InstanceTag #:nodoc:
|
115
|
+
private
|
116
|
+
alias :stock_date_or_time_select :date_or_time_select
|
117
|
+
def date_or_time_select(options, html_options = {})
|
118
|
+
options[:order] ||= [:day, :month, :year]
|
119
|
+
if DATE_HELPERS_RECEIVE_HTML_OPTIONS
|
120
|
+
stock_date_or_time_select(options, html_options)
|
121
|
+
else
|
122
|
+
stock_date_or_time_select(options)
|
124
123
|
end
|
125
|
-
|
124
|
+
end
|
126
125
|
end
|
127
126
|
end
|
128
|
-
|
129
|
-
end #endif
|
127
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
module RuTils
|
2
3
|
module Pluralization #:nodoc:
|
3
4
|
# Выбирает нужный падеж существительного в зависимости от числа
|
@@ -97,10 +98,10 @@ module RuTils
|
|
97
98
|
rest = rest % 100
|
98
99
|
rest1 = rest / 10
|
99
100
|
ones = ""
|
100
|
-
case rest1
|
101
|
-
when 0 then
|
101
|
+
tens = case rest1
|
102
|
+
when 0 then ""
|
102
103
|
when 1 # особый случай
|
103
|
-
|
104
|
+
case rest
|
104
105
|
when 10 then "десять "
|
105
106
|
when 11 then "одиннадцать "
|
106
107
|
when 12 then "двенадцать "
|
@@ -112,14 +113,14 @@ module RuTils
|
|
112
113
|
when 18 then "восемнадцать "
|
113
114
|
when 19 then "девятнадцать "
|
114
115
|
end
|
115
|
-
when 2
|
116
|
-
when 3
|
117
|
-
when 4
|
118
|
-
when 5
|
119
|
-
when 6
|
120
|
-
when 7
|
121
|
-
when 8
|
122
|
-
when 9
|
116
|
+
when 2 then "двадцать "
|
117
|
+
when 3 then "тридцать "
|
118
|
+
when 4 then "сорок "
|
119
|
+
when 5 then "пятьдесят "
|
120
|
+
when 6 then "шестьдесят "
|
121
|
+
when 7 then "семьдесят "
|
122
|
+
when 8 then "восемьдесят "
|
123
|
+
when 9 then "девяносто "
|
123
124
|
end
|
124
125
|
#
|
125
126
|
if rest1 < 1 or rest1 > 1 # единицы
|
@@ -156,8 +157,8 @@ module RuTils
|
|
156
157
|
end
|
157
158
|
|
158
159
|
# сборка строки
|
159
|
-
|
160
|
-
return [
|
160
|
+
plural = [hundreds, tens, ones, end_word, " ", into].join.strip
|
161
|
+
return [plural, tmp_val]
|
161
162
|
end
|
162
163
|
|
163
164
|
# Реализует вывод прописью любого объекта, реализующего Float
|
data/lib/rutils.rb
CHANGED
@@ -1,24 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
$KCODE = 'u'
|
2
3
|
|
4
|
+
require File.dirname(__FILE__) + '/version'
|
5
|
+
|
3
6
|
# Главный контейнер модуля
|
4
7
|
module RuTils
|
5
|
-
#:stopdoc:
|
6
|
-
|
7
8
|
# Папка, куда установлен модуль RuTils. Нужно чтобы автоматически копировать RuTils в другие приложения.
|
8
9
|
INSTALLATION_DIRECTORY = File.expand_path(File.dirname(__FILE__) + '/../') #:nodoc:
|
9
|
-
MAJOR = 0 #:nodoc:
|
10
|
-
MINOR = 2 #:nodoc:
|
11
|
-
TINY = 5 #:nodoc:
|
12
|
-
|
13
|
-
# Стандартный маркер для подстановок - invalid UTF sequence
|
14
|
-
SUBSTITUTION_MARKER = "\xF0\xF0\xF0\xF0" #:nodoc:
|
15
|
-
|
16
|
-
# :startdoc:
|
17
10
|
|
18
|
-
#
|
19
|
-
|
11
|
+
# Стандартный маркер для подстановок - Unicode Character 'OBJECT REPLACEMENT CHARACTER' (U+FFFC)
|
12
|
+
# http://unicode.org/reports/tr20/tr20-1.html
|
13
|
+
# Он официально применяется для обозначения вложенного обьекта
|
14
|
+
SUBSTITUTION_MARKER = [0xEF, 0xBF, 0xBC].pack("U*").freeze
|
20
15
|
|
21
|
-
|
16
|
+
class RemovedFeature < RuntimeError
|
17
|
+
end
|
22
18
|
|
23
19
|
# Метод позволяет проверить, включена ли перегрузка функций других модулей.
|
24
20
|
# Попутно он спрашивает модуль Locale (если таковой имеется) является ли русский
|
@@ -37,28 +33,22 @@ module RuTils
|
|
37
33
|
|
38
34
|
# Включает или выключает перегрузки других модулей. Полезно, например, в случае когда нужно рендерить страницу
|
39
35
|
# сайта на нескольких языках и нужно отключить русское оформление текста для других языков.
|
36
|
+
#
|
37
|
+
# Флаг overrides в RuTils работают в контексте текущей нити
|
40
38
|
def overrides=(new_override_flag)
|
41
39
|
Thread.current[:rutils_overrided_enabled] = (new_override_flag ? true : false)
|
42
40
|
end
|
43
41
|
module_function :overrides=
|
44
42
|
|
45
|
-
def self.thread_local_or_own_flag
|
43
|
+
def self.thread_local_or_own_flag #:nodoc:
|
46
44
|
Thread.current.keys.include?(:rutils_overrided_enabled) ? Thread.current[:rutils_overrided_enabled] : false
|
47
45
|
end
|
48
46
|
|
49
47
|
def self.load_component(name) #:nodoc:
|
50
48
|
require File.join(RuTils::INSTALLATION_DIRECTORY, "lib", name.to_s, name.to_s)
|
51
49
|
end
|
52
|
-
|
53
|
-
def self.reload_component(name) #:nodoc:
|
54
|
-
load File.join(RuTils::INSTALLATION_DIRECTORY, "lib", name.to_s, "#{name}.rb")
|
55
|
-
end
|
56
50
|
end
|
57
51
|
|
58
|
-
|
59
|
-
RuTils::
|
60
|
-
|
61
|
-
RuTils::load_component :datetime # Дата и время без локалей
|
62
|
-
RuTils::load_component :transliteration # Транслит
|
63
|
-
RuTils::load_component :integration # Интеграция с rails, textile и тд
|
64
|
-
RuTils::load_component :countries # Данные о странах на русском и английском
|
52
|
+
[:pluralizer, :gilenson, :datetime, :transliteration, :integration, :countries].each do | submodule |
|
53
|
+
require File.join(RuTils::INSTALLATION_DIRECTORY, "lib", submodule.to_s, submodule.to_s)
|
54
|
+
end
|