Class: CC2HTML::Converter

Inherits:
Object
  • Object
show all
Defined in:
lib/cc2html/converter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cc_file_path, dest_name, options = {}) ⇒ Converter

Returns a new instance of Converter.



5
6
7
8
9
# File 'lib/cc2html/converter.rb', line 5

def initialize(cc_file_path, dest_name, options={})
  @cc_file_path = cc_file_path
  @dest_name = dest_name
  @settings = options
end

Instance Attribute Details

#cc_file_pathObject (readonly)

Returns the value of attribute cc_file_path.



3
4
5
# File 'lib/cc2html/converter.rb', line 3

def cc_file_path
  @cc_file_path
end

#dest_dirObject (readonly)

Returns the value of attribute dest_dir.



3
4
5
# File 'lib/cc2html/converter.rb', line 3

def dest_dir
  @dest_dir
end

Instance Method Details

#convertObject



11
12
13
14
15
16
17
18
# File 'lib/cc2html/converter.rb', line 11

def convert
  manifest = IMS::CC::Manifest.read(@cc_file_path)
  if @settings[:format] == 'html'
    CC2HTML::HtmlBuilder.new(manifest, @dest_name, @cc_file_path).generate
  elsif @settings[:format] == 'epub'
    CC2HTML::EpubBuilder.new(manifest, @dest_name, @cc_file_path, @settings).generate
  end
end