class Expansions::TemplateProcessors
Attributes
processors[R]
Public Class Methods
new(processors={})
click to toggle source
# File lib/expansions/template_processors.rb, line 5 def initialize(processors={}) @processors = processors end
Public Instance Methods
get_processor_for(file_name)
click to toggle source
# File lib/expansions/template_processors.rb, line 9 def get_processor_for(file_name) template_type = File.extname(file_name).gsub(/\./,'').to_sym raise "There is no processor for #{file_name}" unless processor?(template_type) return processors[template_type] end
processor?(template_type)
click to toggle source
# File lib/expansions/template_processors.rb, line 23 def processor?(template_type) return processors.has_key?(template_type.to_sym) end
register_processor(template_type,processor)
click to toggle source
# File lib/expansions/template_processors.rb, line 17 def register_processor(template_type,processor) raise "The processor for the template already exists" if processor?(template_type) processors[template_type.to_sym] = processor end