Class: Mj::AlternativeFile::Resolver
- Inherits:
-
Object
- Object
- Mj::AlternativeFile::Resolver
- Defined in:
- lib/mj/alternative_file/resolver.rb
Instance Method Summary collapse
- #add(resolver) ⇒ Object
-
#initialize ⇒ Resolver
constructor
A new instance of Resolver.
- #resolve(file) ⇒ Object
Constructor Details
#initialize ⇒ Resolver
Returns a new instance of Resolver.
6 7 8 |
# File 'lib/mj/alternative_file/resolver.rb', line 6 def initialize @stack = [] end |
Instance Method Details
#add(resolver) ⇒ Object
10 11 12 |
# File 'lib/mj/alternative_file/resolver.rb', line 10 def add(resolver) @stack.push(resolver) end |
#resolve(file) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/mj/alternative_file/resolver.rb', line 14 def resolve(file) file = AlternativeFile::CurrentFile.new(file.to_s) resolved = @stack.map do |resolver| resolver.resolve(file) end AlternativeFile::Candidates.new(resolved.flatten.compact) end |