Sha256: 959d9317e5e6959835df0dc163db1d64c93fe415d872b29a1bd4fb0faa2813f5
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
# encoding: utf-8 module JLDrill class StartsWith TO_A_RE = Regexp.new("",nil,"u") def initialize(string) @startsWithArray = string.split(TO_A_RE) if @startsWithArray.nil? @startsWithArray = [] end end # Returns the number of characters at the beginning of # string that are also at the beginning of @startsWithArray def numCommonChars(string) i = 0 if !string.nil? a = string.split(TO_A_RE) while (i < a.size) && (i < @startsWithArray.size) && (a[i] == @startsWithArray[i]) do i += 1 end end return i end def match(string) return numCommonChars(string) == @startsWithArray.size end end class Equals def initialize(string) @equalsString = string end def match(string) return @equalsString.eql?(string) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jldrill-0.6.0.1 | lib/jldrill/model/items/edict/ComparisonFunctors.rb |