Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- documented/deprecated.rb,
documented/common/class_exts/string.rb
Overview
Represents a string object with additional functionality.
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 current stream associated with the string.
-
#stream=(val) ⇒ Object
Sets the stream for the string if it is not already set.
-
#to_a ⇒ Array<String>
Converts the string to an array containing the string itself.
-
#to_s ⇒ String
Returns a string representation of the object.
Instance Method Details
#silent ⇒ Boolean
Returns false, indicating that the string is not silent.
94 95 96 |
# File 'documented/deprecated.rb', line 94 def silent false end |
#split_as_list ⇒ Array<String>
Splits the string into a list based on specific patterns.
101 102 103 104 105 |
# File 'documented/deprecated.rb', line 101 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 current stream associated with the string.
14 15 16 |
# File 'documented/common/class_exts/string.rb', line 14 def stream @stream end |
#stream=(val) ⇒ Object
Sets the stream for the string if it is not already set.
21 22 23 |
# File 'documented/common/class_exts/string.rb', line 21 def stream=(val) @stream ||= val end |
#to_a ⇒ Array<String>
Converts the string to an array containing the string itself.
87 88 89 |
# File 'documented/deprecated.rb', line 87 def to_a # for compatibility with Ruby 1.8 [self] end |
#to_s ⇒ String
Returns a string representation of the object.
8 9 10 |
# File 'documented/common/class_exts/string.rb', line 8 def to_s self.dup end |