Module: Epuber::Helper

Defined in:
lib/epuber/helper.rb

Class Method Summary collapse

Class Method Details

.destination_path_for_toc_item(toc_item, file_resolver, context_path) ⇒ String

Parameters:

Returns:

  • (String)


11
12
13
14
15
16
# File 'lib/epuber/helper.rb', line 11

def self.destination_path_for_toc_item(toc_item, file_resolver, context_path)
  file = file_resolver.file_from_request(toc_item.file_request)
  path = [file.final_destination_path, toc_item.file_fragment].compact.join('#')

  Pathname.new(path).relative_path_from(Pathname.new(context_path)).to_s
end