Sha256: e10e7d080078a62f9c06a4cf9dc74f8b4b89f526014d9cff8c89f97304895333

Contents?: true

Size: 335 Bytes

Versions: 5

Compression:

Stored size: 335 Bytes

Contents

class String # :nodoc:
  CAP_LIST_REGEX = Regexp.new( '"([\w\s]+)"|(\S+)' )
  WHITESPACE_REGEX = Regexp.new('^\s+$')

  def for_cap_list
    if self =~ /\s/
      '"'+self+'"'
    else
      self
    end
  end

  def unpack_cap_list
    self.split( CAP_LIST_REGEX ).reject{ |match| match == "" || match =~ WHITESPACE_REGEX }
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rcap-1.3.0 lib/extensions/string.rb
rcap-1.2.4 lib/extensions/string.rb
rcap-1.2.3 lib/extensions/string.rb
rcap-1.2.2 lib/extensions/string.rb
rcap-1.2.1 lib/extensions/string.rb