Module: Detest::FailureDetails::CodeListing

Defined in:
lib/detest.rb

Instance Method Summary collapse

Instance Method Details

#pretty_print(printer) ⇒ Object



1124
1125
1126
1127
1128
1129
# File 'lib/detest.rb', line 1124

def pretty_print printer
  margin = ' ' * printer.indent
  printer.text [
    first, self[1..-1].map {|line| margin + line }, margin
  ].join(printer.newline)
end

#to_yaml(options = {}) ⇒ Object



1116
1117
1118
1119
1120
1121
1122
# File 'lib/detest.rb', line 1116

def to_yaml options = {}
  #
  # strip because to_yaml() will render the paragraph without escaping
  # newlines ONLY IF the first and last character are non-whitespace!
  #
  join("\n").strip.to_yaml(options)
end