Permalink
Browse files

Add a MacRuby-friendly regex syntax

  • Loading branch information...
1 parent 38f3c4b commit 2d9f38b5622c25e40a0b42d1083c4ac9583e5312 @willglynn committed Jun 26, 2012
Showing with 9 additions and 0 deletions.
  1. +2 −0 lib/sass/scss/rx.rb
  2. +7 −0 lib/sass/util.rb
View
@@ -51,6 +51,8 @@ def self.quote(str, flags = 0)
UNICODE = /\\#{H}{1,6}[ \t\r\n\f]?/
s = if Sass::Util.ruby1_8?
'\200-\377'
+ elsif Sass::Util.macruby?
+ '/\u0080-\uD7FF\uE000-\uFFFD\U00010000-\U0010FFFF'
else
'\u{80}-\u{D7FF}\u{E000}-\u{FFFD}\u{10000}-\u{10FFFF}'
end
View
@@ -465,6 +465,13 @@ def ruby1_8?
def ruby1_8_6?
ruby1_8? && Sass::Util::RUBY_VERSION[2] < 7
end
+
+ # Whether or not this is running under MacRuby.
+ #
+ # @return [Boolean]
+ def macruby?
+ RUBY_ENGINE == 'macruby'
+ end
# Checks that the encoding of a string is valid in Ruby 1.9
# and cleans up potential encoding gotchas like the UTF-8 BOM.

0 comments on commit 2d9f38b

Please sign in to comment.