Fix Ruby 2.2 test failures related to frozen objects.

f38
Vít Ondruch 10 years ago
parent 71552f6520
commit cf2d717208

@ -0,0 +1,34 @@
From bbbdedc0c78ec941a84d161d5c610a358310cf99 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Tue, 20 Jan 2015 14:34:44 +0100
Subject: [PATCH] Ignore metadata for frozen classes.
---
lib/i18n/backend/metadata.rb | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/i18n/backend/metadata.rb b/lib/i18n/backend/metadata.rb
index 52c0a29..a8d922a 100644
--- a/lib/i18n/backend/metadata.rb
+++ b/lib/i18n/backend/metadata.rb
@@ -21,11 +21,15 @@ module I18n
def included(base)
Object.class_eval do
def translation_metadata
- @translation_metadata ||= {}
+ unless self.frozen?
+ @translation_metadata ||= {}
+ else
+ {}
+ end
end
def translation_metadata=(translation_metadata)
- @translation_metadata = translation_metadata
+ @translation_metadata = translation_metadata unless self.frozen?
end
end unless Object.method_defined?(:translation_metadata)
end
--
2.1.0

@ -8,6 +8,9 @@ Group: Development/Languages
License: MIT and (BSD or Ruby)
URL: http://github.com/svenfuchs/i18n
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
# Fixes Ruby 2.2 test failures related to frozen objects.
# https://github.com/svenfuchs/i18n/pull/305
Patch0: rubygem-i18n-0.7.0-Ignore-metadata-for-frozen-classes.patch
BuildRequires: ruby
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
@ -33,6 +36,8 @@ gem unpack %{SOURCE0}
%setup -q -D -T -n %{gem_name}-%{version}
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
%patch0 -p1
%build
gem build %{gem_name}.gemspec
%gem_install

Loading…
Cancel
Save