Class: Rouge::Guessers::Disambiguation::Disambiguator

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/rouge/guessers/disambiguation.rb

Instance Method Summary collapse

Methods included from Util

#get_source, #test_glob

Constructor Details

#initialize(patterns, &decider) ⇒ Disambiguator

Returns a new instance of Disambiguator.



50
51
52
53
# File 'lib/rouge/guessers/disambiguation.rb', line 50

def initialize(patterns, &decider)
  @patterns = patterns
  @decider = decider
end

Instance Method Details

#decide!(guesser) ⇒ Object



55
56
57
58
59
60
61
62
# File 'lib/rouge/guessers/disambiguation.rb', line 55

def decide!(guesser)
  out = guesser.instance_eval(&@decider)
  case out
  when Array then out
  when nil then nil
  else [out]
  end
end

#match?(filename) ⇒ Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/rouge/guessers/disambiguation.rb', line 64

def match?(filename)
  @patterns.any? { |p| test_glob(p, filename) }
end