lib/facet/string/first_char.rb in facets-0.7.2 vs lib/facet/string/first_char.rb in facets-0.9.0
- old
+ new
@@ -1,23 +2 @@
-class String
- # Returns first _n_ characters.
- #
- # require 'facet/string/first_char'
- #
- # "Hello World".first_char(3) #=> "Hel"
- #
- def first_char(n=1)
- slice(0, n.to_i)
- end
-end
-
-
-# __TEST__
-
-if __FILE__ == $0
- require 'test/unit'
- class TestCase < Test::Unit::TestCase
- def test_first
- assert_equal( "Hel", "Hello World".first_char(3) )
- end
- end
-end
+require 'nano/string/first_char.rb'
\ No newline at end of file