Method: MdnQuery::Section#append_text
- Defined in:
- lib/mdn_query/section.rb
#append_text(text) ⇒ void
This method returns an undefined value.
Appends a text segment to the section.
Spaces before and after newlines are removed. If the text segment is empty (i.e. consists of just whitespaces), it is not appended.
50 51 52 53 54 |
# File 'lib/mdn_query/section.rb', line 50 def append_text(text) trimmed = text.gsub(/\n[[:blank:]]+|[[:blank:]]+\n/, "\n") escaped = (trimmed) @text << escaped unless text_empty?(escaped) end |