Permalink
Browse files

rename white_space? to white_space_char?

  • Loading branch information...
Stefan Lang
Stefan Lang committed Sep 30, 2012
1 parent 6a3d978 commit 47163fbcd08190d2b8d21ac7d53fca19c528a4be
Showing with 40 additions and 32 deletions.
  1. +1 −1 CHANGES.txt
  2. +1 −1 lib/unicode_utils.rb
  3. +23 −0 lib/unicode_utils/white_space_char_q.rb
  4. +0 −15 lib/unicode_utils/white_space_q.rb
  5. +15 −15 test/test_unicode_utils.rb
View
@@ -6,7 +6,7 @@ Updated to Unicode 6.2.0.
New methods in UnicodeUtils:
-* white_space?
+* white_space_char?
All tests pass with jruby-1.7.0.RC1. Not all tests pass with
MRI 1.9.3p194 due to unexptected behaviour of String#<< with
View
@@ -41,7 +41,7 @@
require "unicode_utils/code_point_type"
require "unicode_utils/name_aliases"
require "unicode_utils/sid"
-require "unicode_utils/white_space_q"
+require "unicode_utils/white_space_char_q"
# This version of UnicodeUtils implements algorithms as defined by
# version 6.1.0 of the Unicode standard. Each public method is
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+
+require "unicode_utils/read_cdata"
+
+module UnicodeUtils
+
+ WHITE_SPACE_SET = Impl.read_code_point_set("white_space_set") # :nodoc:
+
+ # True if the given character has the Unicode property White_Space.
+ #
+ # Example:
+ #
+ # require "unicode_utils/general_category"
+ # require "unicode_utils/white_space_char_q"
+ #
+ # UnicodeUtils.general_category("\n") => :Control
+ # UnicodeUtils.white_space_char?("\n") => true
+ def white_space_char?(char)
+ WHITE_SPACE_SET.include?(char.ord)
+ end
+ module_function :white_space_char?
+
+end
@@ -1,15 +0,0 @@
-# -*- encoding: utf-8 -*-
-
-require "unicode_utils/read_cdata"
-
-module UnicodeUtils
-
- WHITE_SPACE_SET = Impl.read_code_point_set("white_space_set") # :nodoc:
-
- # True if the given character has the Unicode property White_Space.
- def white_space?(char)
- WHITE_SPACE_SET.include?(char.ord)
- end
- module_function :white_space?
-
-end
View
@@ -559,21 +559,21 @@ def test_sid
assert_equal nil, UnicodeUtils.sid(UnicodeUtils::Codepoint::RANGE.end + 1)
end
- def test_white_space?
- assert_equal true, UnicodeUtils.white_space?(" ")
- assert_equal true, UnicodeUtils.white_space?("\n")
- assert_equal true, UnicodeUtils.white_space?("\r")
- assert_equal true, UnicodeUtils.white_space?("\t")
- assert_equal true, UnicodeUtils.white_space?(0xa0)
- assert_equal true, UnicodeUtils.white_space?(0x180e)
- assert_equal true, UnicodeUtils.white_space?(0x2000)
- assert_equal true, UnicodeUtils.white_space?(0x2009)
- assert_equal true, UnicodeUtils.white_space?(0x200a)
- assert_equal true, UnicodeUtils.white_space?(0x2028)
- assert_equal true, UnicodeUtils.white_space?(0x2029)
- assert_equal true, UnicodeUtils.white_space?(0x3000)
- assert_equal false, UnicodeUtils.white_space?("a")
- assert_equal false, UnicodeUtils.white_space?("_")
+ def test_white_space_char?
+ assert_equal true, UnicodeUtils.white_space_char?(" ")
+ assert_equal true, UnicodeUtils.white_space_char?("\n")
+ assert_equal true, UnicodeUtils.white_space_char?("\r")
+ assert_equal true, UnicodeUtils.white_space_char?("\t")
+ assert_equal true, UnicodeUtils.white_space_char?(0xa0)
+ assert_equal true, UnicodeUtils.white_space_char?(0x180e)
+ assert_equal true, UnicodeUtils.white_space_char?(0x2000)
+ assert_equal true, UnicodeUtils.white_space_char?(0x2009)
+ assert_equal true, UnicodeUtils.white_space_char?(0x200a)
+ assert_equal true, UnicodeUtils.white_space_char?(0x2028)
+ assert_equal true, UnicodeUtils.white_space_char?(0x2029)
+ assert_equal true, UnicodeUtils.white_space_char?(0x3000)
+ assert_equal false, UnicodeUtils.white_space_char?("a")
+ assert_equal false, UnicodeUtils.white_space_char?("_")
end
end

0 comments on commit 47163fb

Please sign in to comment.