Algorithm::Diff-0.1 README

Algorithm::Diff ??2????????????????'??????????'????????????????

  1. ????????

* ruby 1.8/1.9
  1. ????????????????

??????????????????????????????????????????????
UNIX ?? OS ???????????? root ??????????????????????

  $ ruby setup.rb config
  $ ruby setup.rb setup
 ($ su)
  # ruby setup.rb install
  1. ??????

    require "algorithm/diff"           # ??????????????????
    
    a = %w(a b c e h j l m n p)
    b = %w(b c d e f j k l m r s t)
    
    d,snake,nn = Algorithm::Diff.ond(a,b) # ????????
    if d
      path = Algorithm::Diff.solve(a,b,d,snake,nn) # path??????
      o = Object.new
      def o.discard_a(i, j, v)         # a??????????
        print "#{i} #{j} > ", v, "\n"
      end
      def o.discard_b(i, j, v)
        print "#{i} #{j} < ", v, "\n"  # b??????????
      end
      def o.match(i, j, v)
        print "#{i} #{j} = ", v, "\n"  # ????????????????????
      end
      Algorithm::Diff.traverse(a,b,path,o)         # ??????????????
    
      # sdiff??????????
      Algorithm::Diff.sdiff(a,b,path).each {|x, a, b|
        puts "#{a}\t#{x}\t#{b}"
      }
    end
    
  2. ??????????

Algorithm::Diff??????????ksr????????Tiki(http://www.todo.org/)??

tiki.cgi??????????????????MoonWolf????????????????????

????????????Ruby????????????????????????

MoonWolf <[email protected]> www.moonwolf.com/ruby/