lib/rezept/utils.rb in rezept-0.4.0 vs lib/rezept/utils.rb in rezept-0.4.1
- old
+ new
@@ -3,15 +3,16 @@
require 'coderay'
module Rezept
class Utils
- def self.diff(converter, hash1, hash2)
- Diffy::Diff.new(
+ def self.diff(converter, hash1, hash2, color=false)
+ diff = Diffy::Diff.new(
converter.to_dsl(hash1),
converter.to_dsl(hash2),
:diff => '-u'
- ).to_s(:color)
+ )
+ color ? diff.to_s(:color) : diff.to_s
end
def self.print_ruby(ruby, color=false)
if color
puts CodeRay.scan(ruby, :ruby).terminal