Module: Coradoc::Converter::CommonInputOutputMethods

Included in:
Input, Output
Defined in:
lib/coradoc/converter.rb

Instance Method Summary collapse

Instance Method Details

#[](id) ⇒ Object



123
124
125
# File 'lib/coradoc/converter.rb', line 123

def [](id)
  @processors[id.to_sym]
end

#define(const) ⇒ Object



119
120
121
# File 'lib/coradoc/converter.rb', line 119

def define(const)
  @processors[const.processor_id] = const
end

#keysObject



127
128
129
# File 'lib/coradoc/converter.rb', line 127

def keys
  @processors.keys
end

#select_processor(filename) ⇒ Object



131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/coradoc/converter.rb', line 131

def select_processor(filename)
  filename = filename.path if filename.respond_to? :path
  unless filename.is_a? String
    raise Converter::NoProcessorError,
          "Can't find a path for #{filename}. You must manually select the processor."
  end

  @processors.values.find do |i|
    i.processor_match?(filename)
  end or raise Converter::NoProcessorError,
               "You must manually select the processor for #{filename}"
end