Class: Convoy::Formatter::StringSplitter
- Inherits:
-
Object
- Object
- Convoy::Formatter::StringSplitter
- Defined in:
- lib/convoy/formatter/string_splitter.rb
Instance Attribute Summary collapse
-
#max_segment_width ⇒ Object
readonly
, :first_segment_max_length.
Instance Method Summary collapse
-
#initialize(max_segment_width, options = {}) ⇒ StringSplitter
constructor
A new instance of StringSplitter.
- #split(input_string) ⇒ Object
Constructor Details
#initialize(max_segment_width, options = {}) ⇒ StringSplitter
Returns a new instance of StringSplitter.
6 7 8 9 |
# File 'lib/convoy/formatter/string_splitter.rb', line 6 def initialize(max_segment_width, = {}) @max_segment_width = max_segment_width #@first_segment_max_length = options[:first_segment_max_length] || max_segment_width end |
Instance Attribute Details
#max_segment_width ⇒ Object (readonly)
, :first_segment_max_length
4 5 6 |
# File 'lib/convoy/formatter/string_splitter.rb', line 4 def max_segment_width @max_segment_width end |
Instance Method Details
#split(input_string) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/convoy/formatter/string_splitter.rb', line 11 def split(input_string) input_strings = input_string.split("\n") [split_strings(input_strings)].flatten #first_string = strings.shift #other_strings = strings #result = [split_first_string(first_string) + split_strings(other_strings)].flatten #result end |