~ubuntu-branches/ubuntu/trusty/ruby-facets/trusty

« back to all changes in this revision

Viewing changes to src/core/facets/string/divide.rb

  • Committer: Package Import Robot
  • Author(s): Marc Dequènes (Duck)
  • Date: 2013-06-21 14:41:38 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130621144138-nb3t82yl5gl8p7a6
Tags: 2.9.3-1
* New upstream release:
  - rakefile is gone, switched back to setuprb method
  - recreated documention build rules and adapted to new paths
* Updated copyright file.
* Increased Standards-Version to 3.9.4 (no changes).
* Removed transitional libfacets-* package and obsolete relations.
* Use system JQuery library instead of embedded one for documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
class String
2
 
 
3
 
  # Breaks a string up into an array based on a regular expression.
4
 
  # Similar to scan, but includes the matches.
5
 
  #
6
 
  #   s = "<p>This<b>is</b>a test.</p>"
7
 
  #   s.divide( /\<.*?\>/ )
8
 
  #   #=> ["<p>This", "<b>is", "</b>a test.", "</p>"]
9
 
  #
10
 
  # CREDIT: Trans
11
 
 
12
 
  def divide( re )
13
 
    re2 = /#{re}.*?(?=#{re}|\Z)/
14
 
    scan(re2) #{re}(?=#{re})/)
15
 
  end
16
 
 
17
 
end
18