module Cfdef::Utils::Helper

Public Instance Methods

diff(obj1, obj2, options = {}) click to toggle source
# File lib/cfdef/utils.rb, line 11
def diff(obj1, obj2, options = {})
  diffy = Diffy::Diff.new(
    obj1.pretty_inspect,
    obj2.pretty_inspect,
    :diff => '-u'
  )

  out = diffy.to_s(options[:color] ? :color : :text).gsub(/\s+\z/m, '')
  out.gsub!(/^/, options[:indent]) if options[:indent]
  out
end
matched?(name) click to toggle source
# File lib/cfdef/utils.rb, line 3
def matched?(name)
  if @options[:target]
    @options[:target] =~ name
  else
    true
  end
end