Method: String#remove_line
- Defined in:
- lib/openc3/core_ext/string.rb
#remove_line(line_number, separator = $/) ⇒ String
Uses the String each_line method to interate through the lines and removes the line specified.
159 160 161 162 163 164 165 166 167 |
# File 'lib/openc3/core_ext/string.rb', line 159 def remove_line(line_number, separator = $/) new_string = '' index = 1 self.each_line(separator) do |line| new_string << line unless index == line_number index += 1 end new_string end |