module EpubForge::Utils::HtmlTranslatorQueue::ClassMethods

Public Instance Methods

categorize( translator ) click to toggle source
# File lib/epubforge/utils/html_translator_queue.rb, line 34
def categorize( translator )
  unless GROUP_NAMES.include?( translator.group )
    puts "No group specified for html translator #{translator}.  Group must be one of the following symbols: #{GROUP_NAMES.map(&:inspect).inspect}"
    return false 
  end

  @translators[:all] << translator
  @translators[:named][translator.name] = translator if translator.name
  @translators[translator.group] << translator
end
each_translator( ) { |translator| ... } click to toggle source
# File lib/epubforge/utils/html_translator_queue.rb, line 49
def each_translator( &block )
  ordered_translators = []
  for group in GROUP_NAMES.map{|g| @translators[g].reverse }
    ordered_translators += group
  end

  if block_given?
    for translator in ordered_translators
      yield translator
    end
  else
    ordered_translators.to_enum
  end
end
loader_pattern_register_item( translator ) click to toggle source
# File lib/epubforge/utils/html_translator_queue.rb, line 14
def loader_pattern_register_item( translator )
  @translators ||= {}
  @translators[:all] ||= []
  @translators[:named] ||= {}

  for name in HtmlTranslatorQueue::GROUP_NAMES
    @translators[name] ||= []
  end

  self.categorize( translator )

  nil    # returning true will break loader
end
location( name, path = nil ) click to toggle source
# File lib/epubforge/utils/html_translator_queue.rb, line 64
def location( name, path = nil )
  @exec_location ||= {}
  @exec_location[name] = path if path
  @exec_location[name]
end
named( sym ) click to toggle source
# File lib/epubforge/utils/html_translator_queue.rb, line 45
def named( sym )
  @translators[:named][sym]
end
translators() click to toggle source
# File lib/epubforge/utils/html_translator_queue.rb, line 30
def translators
  @translators
end