Class: ApiHammer::TrailingNewline::TNLBodyProxy
- Includes:
- Enumerable
- Defined in:
- lib/api_hammer/trailing_newline.rb
Instance Method Summary collapse
Instance Method Details
#each {|"\n"| ... } ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/api_hammer/trailing_newline.rb', line 15 def each last_has_newline = false blank = true @body.each do |e| last_has_newline = e =~ /\n\z/m blank = false if e != '' yield e end yield "\n" unless blank || last_has_newline end |