air18n 0.0.4 → 0.0.5
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/lib/air18n/class_methods.rb +3 -1
- data/lib/air18n/version.rb +1 -1
- data/make_gem +4 -0
- metadata +2 -1
data/lib/air18n/class_methods.rb
CHANGED
@@ -176,13 +176,15 @@ module Air18n
|
|
176
176
|
def parse_date s, locale = nil
|
177
177
|
return s if s.nil?
|
178
178
|
|
179
|
+
# `to_str` is needed for ActiveSupport::SafeBuffer coming in from controllers.
|
180
|
+
s = s.to_str
|
181
|
+
|
179
182
|
if /\A[0-9]{4}-[0-9]{2}-[0-9]{2}\Z/.match s
|
180
183
|
# If this looks like an ISO date, YYYY-mm-dd, let [Date.parse] handle
|
181
184
|
# parsing since [Date.strptime] varies by platform (darwin vs. linux)
|
182
185
|
Date.parse(s, true)
|
183
186
|
else
|
184
187
|
locale ||= I18n.full_locale
|
185
|
-
s = s.to_str
|
186
188
|
format = I18n.t('date.formats.default', :locale => locale.to_sym)
|
187
189
|
begin
|
188
190
|
date = Date.strptime(s, format)
|
data/lib/air18n/version.rb
CHANGED
data/make_gem
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: air18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -167,6 +167,7 @@ files:
|
|
167
167
|
- lib/air18n/xss_detector.rb
|
168
168
|
- lib/generators/air18n/migration/migration_generator.rb
|
169
169
|
- lib/generators/air18n/migration/templates/active_record/migration.rb
|
170
|
+
- make_gem
|
170
171
|
- spec/database.yml
|
171
172
|
- spec/factories.rb
|
172
173
|
- spec/lib/air18n/air18n_spec.rb
|