Skip to content

Commit 98d562f

Browse files
committed
2 parents f72f141 + 412920b commit 98d562f

12 files changed

+23
-28
lines changed

.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.6.3

.travis.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
language: ruby
22
rvm:
3-
- 2.0.0
4-
- 2.1.10
5-
- 2.2.10
6-
- 2.3.8
73
- 2.4.5
84
- 2.5.5
9-
- 2.6.2
5+
- 2.6.2 # Uses unicode 12.0.0
6+
- 2.6.3 # Uses unicode 12.1.0
107
- ruby-head
118
matrix:
129
allow_failures:

README.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,18 @@ Obviously, you will get different (random) results if you try these yourself!
5252
```
5353

5454
## Supported ruby versions
55-
* MRI 2.0.x
56-
* MRI 2.1.x
57-
* MRI 2.2.x
58-
* MRI 2.3.x
59-
* MRI 2.4.x
60-
* MRI 2.5.x
61-
* MRI 2.6.x
62-
63-
MRI ≤ 1.9.3 are not supported. This is primarily because MRI 2.0.0 introduced a new
64-
regexp engine (`Oniguruma` was replaced by `Onigmo`). Whilst *most* of this gem could
65-
be made to work with MRI 1.9.x (or even 1.8.x), I feel the changes are too significant
66-
to implement backwards compatability (especially since [long-term support for MRI
67-
1.9.3 has now ended](https://www.ruby-lang.org/en/news/2014/01/10/ruby-1-9-3-will-end-on-2015/)).
68-
69-
For example, named properties (e.g. `/\p{Alpha}/`) are illegal syntax on MRI 1.9.3.
55+
MRI 2.4.0 (oldest non-[EOL](https://www.ruby-lang.org/en/news/2019/03/31/support-of-ruby-2-3-has-ended/) version) --> 2.6.3 (latest stable version)
56+
57+
MRI 2.0.0 --> 2.3.x were supported until version `1.5.0` of this library. Support was dropped primarily
58+
because of the need to use `RbConfig::CONFIG['UNICODE_VERSION']`, which was added to ruby version `2.4.0`.
59+
60+
MRI versions ≤ 1.9.3 were never supported by this library. This is primarily because MRI 2.0.0 introduced a new
61+
regexp engine (`Oniguruma` was replaced by `Onigmo` -- For example, named properties like `/\p{Alpha}/`
62+
are illegal syntax on MRI 1.9.3.). Whilst *most* of this gem could be made to work with MRI 1.9.x
63+
(or even 1.8.x), I considered the changes too significant to implement backwards compatability
64+
(especially since [long-term support for MRI 1.9.3 has long
65+
ended](https://www.ruby-lang.org/en/news/2014/01/10/ruby-1-9-3-will-end-on-2015/)).
66+
7067

7168
Other implementations, such as JRuby, could probably work fine -
7269
but I haven't fully tried/tested it. Pull requests are welcome.
File renamed without changes.
File renamed without changes.
16.2 KB
Binary file not shown.
16.2 KB
Binary file not shown.

db/unicode_ranges_2.0.pstore

-16.1 KB
Binary file not shown.
File renamed without changes.

lib/regexp-examples/unicode_char_ranges.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ class UnicodeCharRanges
1111
# These values were generated by: scripts/unicode_lister.rb
1212
# Note: Only the first 128 results are listed, for performance.
1313
# 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
1615

1716
attr_reader :range_store
1817

@@ -30,10 +29,12 @@ def get(key)
3029

3130
private
3231

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
3334
def unicode_ranges_file
3435
db_path = File.join(__dir__, '../../db')
3536
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}"
3738
end.last
3839
end
3940

0 commit comments

Comments
 (0)