Class: BbEPUB::Package

Inherits:
Bookbinder::Package
  • Object
show all
Defined in:
lib/bb-epub/package.rb

Constant Summary collapse

DEFAULT_TRANSFORMS =
[
  BbEPUB::Transform::PackageIdentifier,
  BbEPUB::Transform::Title,
  BbEPUB::Transform::Creator,
  BbEPUB::Transform::Contributor,
  BbEPUB::Transform::Language,
  BbEPUB::Transform::CoverImage,
  BbEPUB::Transform::Description,
  BbEPUB::Transform::Version,
  BbEPUB::Transform::Spine,
  BbEPUB::Transform::Resources,
  BbEPUB::Transform::NavToc,
  BbEPUB::Transform::CoverPage,
  BbEPUB::Transform::Rendition,
  BbEPUB::Transform::AudioOverlay,
  Bookbinder::Transform::Organizer,
  Bookbinder::Transform::Generator
]
DEFAULT_CONTENT_ROOT =
'EPUB'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.recognize(path) ⇒ Object



27
28
29
30
31
32
# File 'lib/bb-epub/package.rb', line 27

def self.recognize(path)
  return (
    File.extname(path).downcase == '.epub' ||
    File.directory?(File.join(path, 'META-INF'))
  )
end

.transformsObject



35
36
37
# File 'lib/bb-epub/package.rb', line 35

def self.transforms
  @transforms ||= DEFAULT_TRANSFORMS
end

Instance Method Details

#make_href(path) ⇒ Object



50
51
52
# File 'lib/bb-epub/package.rb', line 50

def make_href(path)
  CGI.escape(path)
end

#make_id(path) ⇒ Object



40
41
42
# File 'lib/bb-epub/package.rb', line 40

def make_id(path)
  path.gsub(/[^\w]/, '-')
end

#make_path(href) ⇒ Object



45
46
47
# File 'lib/bb-epub/package.rb', line 45

def make_path(href)
  CGI.unescape(href)
end