From a07f6a78b8daed7e76fd817d687dd6757833dea1 Mon Sep 17 00:00:00 2001 From: Martin Sabo Date: Thu, 14 May 2020 14:22:00 +0200 Subject: [PATCH 1/5] Added support for nil date input. --- lib/i18n_alchemy/date_parser.rb | 1 + test/i18n_alchemy/date_parser_test.rb | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib/i18n_alchemy/date_parser.rb b/lib/i18n_alchemy/date_parser.rb index fd9cccc..0fd0a32 100644 --- a/lib/i18n_alchemy/date_parser.rb +++ b/lib/i18n_alchemy/date_parser.rb @@ -40,6 +40,7 @@ def valid_for_localization?(value) end def valid_for_parsing?(value) + return false if value.nil? !valid_for_localization?(value) end end diff --git a/test/i18n_alchemy/date_parser_test.rb b/test/i18n_alchemy/date_parser_test.rb index ac7aaba..10ba2d8 100644 --- a/test/i18n_alchemy/date_parser_test.rb +++ b/test/i18n_alchemy/date_parser_test.rb @@ -6,6 +6,10 @@ def setup @date = Date.new(2011, 12, 31) end + def test_does_not_convert_nil + assert_nil @parser.parse(nil) + end + def test_does_not_convert_non_string_objects assert_equal @date, @parser.parse(@date) end From dd53eae279f3d255d76803480f49e6aea363f13e Mon Sep 17 00:00:00 2001 From: Martin Sabo Date: Fri, 19 Mar 2021 10:58:37 +0100 Subject: [PATCH 2/5] Gemspec adjustment - allow Rails 6.1.x --- i18n_alchemy.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/i18n_alchemy.gemspec b/i18n_alchemy.gemspec index 74d115b..14736ce 100644 --- a/i18n_alchemy.gemspec +++ b/i18n_alchemy.gemspec @@ -19,8 +19,8 @@ Gem::Specification.new do |s| s.add_dependency "activesupport", ">= 4.0.0", "< 6.1" s.add_dependency "i18n", ">= 0.7" - s.add_development_dependency "actionpack", ">= 4.0.0", "< 6.1" - s.add_development_dependency "activerecord", ">= 4.0.0", "< 6.1" + s.add_development_dependency "actionpack", ">= 4.0.0", "~> 6.1" + s.add_development_dependency "activerecord", ">= 4.0.0", "~> 6.1" s.add_development_dependency "minitest", ">= 4.3.2" s.add_development_dependency "rake", ">= 10.1" end From 08c9836b3d92455f20622bac9ccfdcd7d38b9dde Mon Sep 17 00:00:00 2001 From: Martin Sabo Date: Fri, 19 Mar 2021 11:18:42 +0100 Subject: [PATCH 3/5] Gemspec adjustment - leftover fix --- i18n_alchemy.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n_alchemy.gemspec b/i18n_alchemy.gemspec index 14736ce..62bc840 100644 --- a/i18n_alchemy.gemspec +++ b/i18n_alchemy.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| s.test_files = Dir["test/**/*"] s.require_paths = ["lib"] - s.add_dependency "activesupport", ">= 4.0.0", "< 6.1" + s.add_dependency "activesupport", ">= 4.0.0", "~> 6.1" s.add_dependency "i18n", ">= 0.7" s.add_development_dependency "actionpack", ">= 4.0.0", "~> 6.1" From 9652310b47d7298c24001cae8dcef8caed7b8735 Mon Sep 17 00:00:00 2001 From: Martin Sabo Date: Tue, 21 Mar 2023 15:47:41 +0100 Subject: [PATCH 4/5] Synced gemspec from master --- i18n_alchemy.gemspec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/i18n_alchemy.gemspec b/i18n_alchemy.gemspec index 62bc840..1b19d3e 100644 --- a/i18n_alchemy.gemspec +++ b/i18n_alchemy.gemspec @@ -6,6 +6,7 @@ Gem::Specification.new do |s| s.name = "i18n_alchemy" s.version = I18n::Alchemy::VERSION s.platform = Gem::Platform::RUBY + s.licenses = ["MIT"] s.authors = ["Carlos Antonio da Silva"] s.email = ["carlosantoniodasilva@gmail.com"] s.homepage = "" @@ -16,11 +17,13 @@ Gem::Specification.new do |s| s.test_files = Dir["test/**/*"] s.require_paths = ["lib"] - s.add_dependency "activesupport", ">= 4.0.0", "~> 6.1" + s.required_ruby_version = '>= 2.5.0' + + s.add_dependency "activesupport", ">= 4.0.0", "< 8.0" s.add_dependency "i18n", ">= 0.7" - s.add_development_dependency "actionpack", ">= 4.0.0", "~> 6.1" - s.add_development_dependency "activerecord", ">= 4.0.0", "~> 6.1" + s.add_development_dependency "actionpack", ">= 4.0.0", "< 8.0" + s.add_development_dependency "activerecord", ">= 4.0.0", "< 8.0" s.add_development_dependency "minitest", ">= 4.3.2" s.add_development_dependency "rake", ">= 10.1" end From c2d8ab13cf3306bf5e810e617477bc1722f7870a Mon Sep 17 00:00:00 2001 From: Martin Sabo Date: Wed, 22 Mar 2023 12:59:20 +0100 Subject: [PATCH 5/5] Warning fix (ruby2_keywords not needed) --- lib/i18n_alchemy/proxy.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/i18n_alchemy/proxy.rb b/lib/i18n_alchemy/proxy.rb index 89536d7..faca796 100644 --- a/lib/i18n_alchemy/proxy.rb +++ b/lib/i18n_alchemy/proxy.rb @@ -61,7 +61,6 @@ def try(*a, &b) def method_missing(*args, **kwargs, &block) @target.send(*args, **kwargs, &block) end - ruby2_keywords :method_missing else def method_missing(*args, &block) @target.send(*args, &block)