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.
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
64 65 66 |
# File 'lib/rouge/guessers/disambiguation.rb', line 64 def match?(filename) @patterns.any? { |p| test_glob(p, filename) } end |