Module: DIFECTS::FailureDetails::CodeListing

Defined in:
lib/difects.rb

Instance Method Summary collapse

Instance Method Details

#pretty_print(printer) ⇒ Object



1080
1081
1082
1083
1084
1085
# File 'lib/difects.rb', line 1080

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



1072
1073
1074
1075
1076
1077
1078
# File 'lib/difects.rb', line 1072

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