1 require 'stringray/core_ext'
2 require 'stringray/includes'
4 class StringRay < Array
11 # @see StringRay::Includes#enumerate
12 # @see StringRay::Includes.whitespace=
13 # Controls how +StringRay::Includes#enumerate+ deals with whitespace by default.
15 # @param [Symbol] whitespace How to handle whitespace - :attach_before,
16 # :standalone, or :attach_after
17 def self.whitespace= whitespace
18 @@whitespace = whitespace
22 @@whitespace ||= :attach_before
26 # @see StringRay::Includes#enumerate
27 # @see StringRay::Includes.delemiters=
28 # Controls how +StringRay::Includes#enumerate+ deals with delemiters by default.
30 # @param [Symbol] delemiters How to handle delemiters - :attach_before,
31 # :standalone, or :attach_after
32 def self.delemiters= delemiters
33 @@delemiters = delemiters
37 @@delemiters ||= :attach_before
40 # @see StringRay::Word.new
41 def Word word; Word.new word; end
44 # A wrapper class for strings that are 'words' in and of themselves,
45 # composed of 'word characters'.
52 # @see StringRay::Whitespace.new
53 def Whitespace whitespace; Whitespace.new whitespace; end
56 # A wrapper class for strings that are 'whitespace' composed of 'whitespace
58 class Whitespace < String
59 Characters = [" ", "\t", "\n"]
66 # @see StringRay::Delimiter.new
67 def Delimiter delimiter; Delimiter.new delimiter; end
70 # A wrapper class for strings that are 'delimiters' composed of 'delimiter
72 class Delimiter < String
73 Characters = ['-', ',', '.', '?', '!', ':', ';', '/', '\\', '|']