Module: Treebis::Antecedent

Included in:
FileUtilsProxy
Defined in:
lib/treebis.rb

Instance Method Summary collapse

Instance Method Details

#init_path_antecedentObject



30
31
32
# File 'lib/treebis.rb', line 30

def init_path_antecedent
  @antecedent = {}
end

#path_antecedent(domain, string) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/treebis.rb', line 33

def path_antecedent domain, string
  if @antecedent[domain] && head =common_head(@antecedent[domain], string)
    @antecedent[domain] = [@antecedent[domain], string].max_by(&:length)
    path_antecedent_truncate head, string
  else
    @antecedent[domain] = string
    string
  end
end