diff --git a/.gitignore b/.gitignore index d80e6e0..4a2d7c9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ .DS_Store -.bundle +*.bundle public/.DS_Store .kdev4 .rspec diff --git a/.travis.yml b/.travis.yml index 6da1f01..59ae75b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: ruby rvm: - - 2.1.2 + - 2.2.2 + - 2.1.6 - 2.0.0 - 1.9.3 - rbx-2 diff --git a/ext/fast_blank/fast_blank.c b/ext/fast_blank/fast_blank.c index 8d8c678..4b46036 100644 --- a/ext/fast_blank/fast_blank.c +++ b/ext/fast_blank/fast_blank.c @@ -2,6 +2,7 @@ #include #include #include +#include #define STR_ENC_GET(str) rb_enc_from_index(ENCODING_GET(str)) @@ -13,6 +14,17 @@ #define RSTRING_LEN(s) (RSTRING(s)->len) #endif +static int +ruby_version_before_2_2() +{ + #ifdef RUBY_API_VERSION_MAJOR + if (RUBY_API_VERSION_MAJOR > 2 || (RUBY_API_VERSION_MAJOR == 2 && RUBY_API_VERSION_MINOR >= 2)) { + return 0; + } + #endif + return 1; +} + static VALUE rb_str_blank_as(VALUE str) { @@ -38,7 +50,6 @@ rb_str_blank_as(VALUE str) case 0x85: case 0xa0: case 0x1680: - case 0x180e: case 0x2000: case 0x2001: case 0x2002: @@ -57,6 +68,8 @@ rb_str_blank_as(VALUE str) case 0x3000: /* found */ break; + case 0x180e: + if (ruby_version_before_2_2()) break; default: return Qfalse; }