Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- documented/deprecated.rb,
documented/common/class_exts/string.rb
Overview
Extends the String class with additional functionality. This class adds methods to enhance string manipulation.
Instance Method Summary collapse
-
#silent ⇒ Boolean
Returns false, indicating that the string is not silent.
-
#split_as_list ⇒ Array<String>
Splits the string into a list based on specific patterns.
-
#stream ⇒ Object?
Retrieves the stream value associated with the string.
-
#stream=(val) ⇒ Object
Sets the stream value for the string if not already set.
-
#to_a ⇒ Array<String>
Converts the string to an array containing the string itself.
-
#to_s ⇒ String
Returns a duplicate of the string.
Instance Method Details
#silent ⇒ Boolean
Returns false, indicating that the string is not silent.
107 108 109 |
# File 'documented/deprecated.rb', line 107 def silent false end |
#split_as_list ⇒ Array<String>
Splits the string into a list based on specific patterns.
116 117 118 119 120 |
# File 'documented/deprecated.rb', line 116 def split_as_list string = self string.sub!(/^You (?:also see|notice) |^In the .+ you see /, ',') string.sub('.', '').sub(/ and (an?|some|the)/, ', \1').split(',').reject { |str| str.strip.empty? }.collect { |str| str.lstrip } end |
#stream ⇒ Object?
Retrieves the stream value associated with the string.
25 26 27 |
# File 'documented/common/class_exts/string.rb', line 25 def stream @stream end |
#stream=(val) ⇒ Object
Sets the stream value for the string if not already set.
36 37 38 |
# File 'documented/common/class_exts/string.rb', line 36 def stream=(val) @stream ||= val end |
#to_a ⇒ Array<String>
Converts the string to an array containing the string itself.
99 100 101 |
# File 'documented/deprecated.rb', line 99 def to_a # for compatibility with Ruby 1.8 [self] end |
#to_s ⇒ String
Returns a duplicate of the string.
16 17 18 |
# File 'documented/common/class_exts/string.rb', line 16 def to_s self.dup end |