[Groonga-commit] ranguba/chupa-text at 1b4cbb1 [master] Remove "." from extension

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Jan 1 22:47:34 JST 2014


Kouhei Sutou	2014-01-01 22:47:34 +0900 (Wed, 01 Jan 2014)

  New Revision: 1b4cbb19f6bbe0173c67a29615f7ef0af221f7b1
  https://github.com/ranguba/chupa-text/commit/1b4cbb19f6bbe0173c67a29615f7ef0af221f7b1

  Message:
    Remove "." from extension

  Modified files:
    lib/chupa-text/data.rb
    test/test-data.rb

  Modified: lib/chupa-text/data.rb (+2 -2)
===================================================================
--- lib/chupa-text/data.rb    2014-01-01 22:46:59 +0900 (ccb13d0)
+++ lib/chupa-text/data.rb    2014-01-01 22:47:34 +0900 (4c51fa3)
@@ -57,10 +57,10 @@ module ChupaText
 
     # @return [String, nil] Normalized extension as String if {#path}
     #   is not `nil`, `nil` otherwise. The normalized extension uses
-    #   lower case like `.pdf` not `.PDF`.
+    #   lower case like `pdf` not `PDF`.
     def extension
       return nil if****@path*****?
-      @path.extname.downcase
+      @path.extname.downcase.gsub(/\A\./, "")
     end
 
     # @return [Bool] true if content-type is "text/plain", false

  Modified: test/test-data.rb (+3 -3)
===================================================================
--- test/test-data.rb    2014-01-01 22:46:59 +0900 (9a5978d)
+++ test/test-data.rb    2014-01-01 22:47:34 +0900 (bc7b1fa)
@@ -43,15 +43,15 @@ class TestData < Test::Unit::TestCase
     end
 
     def test_lower_case
-      assert_equal(".md", extension("README.md"))
+      assert_equal("md", extension("README.md"))
     end
 
     def test_upper_case
-      assert_equal(".md", extension("README.MD"))
+      assert_equal("md", extension("README.MD"))
     end
 
     def test_mixed_case
-      assert_equal(".md", extension("README.mD"))
+      assert_equal("md", extension("README.mD"))
     end
 
     private
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index