module Diffing
Public Instance Methods
differences(attr, options={:format => :html})
click to toggle source
Get a diff between the current and draft status of an ActiveRecord object field.
@param [Symbol] attr the attribute you want to diff. @param [Hash] options an options hash allowing you to pass a :format. @return [String] a diff string. If :format was nil, this could be a
[Diffy::Diff].
# File lib/drafter/diffing.rb, line 10 def differences(attr, options={:format => :html}) if self.draft Diffy::Diff.new(self.send(attr), self.draft.send(attr)).to_s(options[:format]) end end