File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,7 @@ class UnicodeCharRanges
11
11
# These values were generated by: scripts/unicode_lister.rb
12
12
# Note: Only the first 128 results are listed, for performance.
13
13
# Also, some groups seem to have no matches (weird!)
14
- # (Don't care about ruby micro version number)
15
- STORE_FILENAME = "unicode_ranges_#{ RUBY_VERSION [ 0 ..2 ] } .pstore" . freeze
14
+ STORE_FILENAME = "unicode_ranges_#{ RbConfig ::CONFIG [ 'UNICODE_VERSION' ] } .pstore" . freeze
16
15
17
16
attr_reader :range_store
18
17
@@ -30,10 +29,12 @@ def get(key)
30
29
31
30
private
32
31
32
+ # The method is written like this to future-proof it a little,
33
+ # i.e. the gem won't completely break for a new ruby version release
33
34
def unicode_ranges_file
34
35
db_path = File . join ( __dir__ , '../../db' )
35
36
Dir [ "#{ db_path } /*.pstore" ] . sort . select do |file |
36
- file <= "#{ db_path } /unicode_ranges_ #{ RUBY_VERSION [ 0 .. 2 ] } .pstore "
37
+ file <= "#{ db_path } /#{ STORE_FILENAME } "
37
38
end . last
38
39
end
39
40
You can’t perform that action at this time.
0 commit comments