Module: Detest::FailureDetails::CodeListing

Defined in:
lib/detest.rb

Instance Method Summary collapse

Instance Method Details

#pretty_print(printer) ⇒ Object



1122
1123
1124
1125
1126
1127
# File 'lib/detest.rb', line 1122

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



1114
1115
1116
1117
1118
1119
1120
# File 'lib/detest.rb', line 1114

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