Method: Websitary::Htmldiff#initialize

Defined in:
lib/websitary/htmldiff.rb

#initialize(args) ⇒ Htmldiff

args

A hash

Fields:

:oldtext

The old version

:newtext

The new version

:highlight

Don’t strip old content but highlight new one with this color

:args

Command-line arguments



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/websitary/htmldiff.rb', line 28

def initialize(args)
    @args = args
    @high = args[:highlight] || args[:highlightcolor]
    @old  = explode(args[:olddoc] || Hpricot(args[:oldtext] || File.read(args[:oldfile])))
    @new  =         args[:newdoc] || Hpricot(args[:newtext] || File.read(args[:newfile]))
    @ignore  = args[:ignore]
    if @ignore and !@ignore.kind_of?(Enumerable)
        die "Ignore must be of kind Enumerable: #{ignore.inspect}"
    end
    @changed = false
end