#!ruby -w require 'diff/lcs' class M attr_reader :m def initialize(m) @m=m end def ==( o ) o.m == @m end def hash @m.hash end def to_s return @m.to_s end end s1 = %w(ma be c e h j l m n po) s2 = %w(ma be c d e f j k l m r s ta) puts "LCS Objects:" puts Diff::LCS::Internals.lcs(s1.map{ |s| M.new(s) } , s2.map { |s| M.new(s) }) puts puts "LCS Strings:" puts Diff::LCS::Internals.lcs(s1, s2)