Sha256: 2334372d95e5a82c093a22f2b92c72ab1a8434484abb086d0e228cd8ed0c1ca1

Contents?: true

Size: 728 Bytes

Versions: 19

Compression:

Stored size: 728 Bytes

Contents

class String

  # Essentially makes #to_a an alias for split,
  # with the excpetion that if no divider is given
  # then the array is split on charaters, and
  # NOT on the global input record divider ($/).
  #
  # WARNING There is a slight chance of
  # incompatability with other libraries which
  # depend on spliting with $/ (although doing 
  # so is a very bad idea!).
 
  def to_a(div=//,limit=0)
    split(div,limit)
  end

end


#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
=begin test

  require 'test/unit'

  class TCString < Test::Unit::TestCase

    def test_to_a
      arr = 'abc'
      assert_equal( ['a','b','c'], arr.to_a )
    end

  end

=end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
facets-1.3.1 lib/facets/core/string/to_a.rb
facets-1.3.2 lib/facets/core/string/to_a.rb
facets-1.3.3 lib/facets/core/string/to_a.rb
facets-1.4.1 lib/facets/core/string/to_a.rb
facets-1.4.2 lib/facets/core/string/to_a.rb
facets-1.4.0 lib/facets/core/string/to_a.rb
facets-1.4.3 lib/facets/core/string/to_a.rb
facets-1.4.5 lib/facets/core/string/to_a.rb
facets-1.4.4 lib/facets/core/string/to_a.rb
facets-1.7.30 lib/facets/core/string/to_a.rb
facets-1.7.0 lib/facets/core/string/to_a.rb
facets-1.7.38 lib/facets/core/string/to_a.rb
facets-1.7.46 lib/facets/core/string/to_a.rb
facets-1.8.0 lib/facets/core/string/to_a.rb
facets-1.8.20 lib/facets/core/string/to_a.rb
facets-1.8.51 lib/facets/core/string/to_a.rb
facets-1.8.49 lib/facets/core/string/to_a.rb
facets-1.8.8 lib/facets/core/string/to_a.rb
facets-1.8.54 lib/facets/core/string/to_a.rb