Class: Rouge::Guessers::Disambiguation::Disambiguator
- Inherits:
-
Object
- Object
- Rouge::Guessers::Disambiguation::Disambiguator
- Includes:
- Util
- Defined in:
- lib/rouge/guessers/disambiguation.rb
Instance Method Summary collapse
- #decide!(guesser) ⇒ Object
-
#initialize(patterns, &decider) ⇒ Disambiguator
constructor
A new instance of Disambiguator.
- #match?(filename) ⇒ Boolean
Methods included from Util
Constructor Details
#initialize(patterns, &decider) ⇒ Disambiguator
Returns a new instance of Disambiguator.
48 49 50 51 |
# File 'lib/rouge/guessers/disambiguation.rb', line 48 def initialize(patterns, &decider) @patterns = patterns @decider = decider end |
Instance Method Details
#decide!(guesser) ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/rouge/guessers/disambiguation.rb', line 53 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
62 63 64 |
# File 'lib/rouge/guessers/disambiguation.rb', line 62 def match?(filename) @patterns.any? { |p| test_glob(p, filename) } end |