Skip to content
Browse files

Merge branch 'fakefs-fix'

Resolves issue with FakeFS preventing unicode tables from being loaded.
  • Loading branch information...
2 parents 1e532c6 + bfc4fef commit b5f127e1a7549751868f4a087d798432b24f07a2 @sporkmonger committed Mar 30, 2013
Showing with 14 additions and 4 deletions.
  1. +14 −4 lib/addressable/idna/pure.rb
View
18 lib/addressable/idna/pure.rb
@@ -317,10 +317,20 @@ def self.lookup_unicode_composition(unpacked)
UNICODE_DATA_LOWERCASE = 5
UNICODE_DATA_TITLECASE = 6
- # This is a sparse Unicode table. Codepoints without entries are
- # assumed to have the value: [0, 0, nil, nil, nil, nil, nil]
- UNICODE_DATA = File.open(UNICODE_TABLE, "rb") do |file|
- Marshal.load(file.read)
+ begin
+ if defined?(FakeFS)
+ fakefs_state = FakeFS.activated?
+ FakeFS.deactivate!
+ end
+ # This is a sparse Unicode table. Codepoints without entries are
+ # assumed to have the value: [0, 0, nil, nil, nil, nil, nil]
+ UNICODE_DATA = File.open(UNICODE_TABLE, "rb") do |file|
+ Marshal.load(file.read)
+ end
+ ensure
+ if defined?(FakeFS)
+ FakeFS.activate! if fakefs_state
+ end
end
COMPOSITION_TABLE = {}

0 comments on commit b5f127e

Please sign in to comment.
Something went wrong with that request. Please try again.