class String

Public Instance Methods

longest_common_substrings_with(rhs) click to toggle source

DESCRIPTION

Finds the longest common substrings in two strings.

Fast and small memory footprint clone detection algorithm developed by Yutaka Yanoh. This algorithm is based on “suffix array with height” data structure.

PARAMETER

rhs

String – A String comparing to the receiver.

RETURN VALUE

Array< SubstringPair > – The longest common substrings.

# File lib/adlint/prelude.rb, line 182
def longest_common_substrings_with(rhs)
  suffix_array = SuffixArray.new(LeftSuffix.of(self) + RightSuffix.of(rhs))
  suffix_array.longest_common_substrings
end
to_default_external() click to toggle source
# File lib/adlint/prelude.rb, line 73
def to_default_external
  encode(Encoding.default_external, :invalid => :replace, :undef => :replace)
end