Class: BuildMaster::ContentEngineRepository
- Inherits:
-
Object
- Object
- BuildMaster::ContentEngineRepository
- Defined in:
- lib/buildmaster/site/content_engine_repository.rb
Instance Method Summary collapse
- #for_candidate(directory, basename) ⇒ Object
- #for_source(source_file) ⇒ Object
-
#initialize ⇒ ContentEngineRepository
constructor
A new instance of ContentEngineRepository.
- #supports?(extname) ⇒ Boolean
Constructor Details
#initialize ⇒ ContentEngineRepository
Returns a new instance of ContentEngineRepository.
4 5 6 7 8 9 10 11 |
# File 'lib/buildmaster/site/content_engine_repository.rb', line 4 def initialize @map = Hash.new @map['.textile'] = TextileEngine.new @map['.markdown'] = MarkdownEngine.new @map['.html'] = HtmlEngine.new @map['.txt'] = TextileEngine.new @map['.deplate'] = DeplateEngine.new end |
Instance Method Details
#for_candidate(directory, basename) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/buildmaster/site/content_engine_repository.rb', line 21 def for_candidate(directory, basename) @map.each_pair do |extname, engine| candidate = directory.file("#{basename}#{extname}") if candidate.exists? return candidate, engine end end return nil, nil end |
#for_source(source_file) ⇒ Object
17 18 19 |
# File 'lib/buildmaster/site/content_engine_repository.rb', line 17 def for_source(source_file) @map[source_file.extname] end |
#supports?(extname) ⇒ Boolean
13 14 15 |
# File 'lib/buildmaster/site/content_engine_repository.rb', line 13 def supports?(extname) @map.has_key?(extname) end |