module EPUB::Book::Features

Attributes

epub_file[RW]
ocf[R]

Public Instance Methods

container_adapter() click to toggle source
# File lib/epub/book/features.rb, line 41
def container_adapter
  @adapter || OCF::PhysicalContainer.adapter
end
container_adapter=(adapter) click to toggle source
# File lib/epub/book/features.rb, line 45
def container_adapter=(adapter)
  @adapter = OCF::PhysicalContainer.find_adapter(adapter)
end
cover_image() click to toggle source

Cover image defined in EPUB 3 or used in EPUB 2 @return [EPUB::Publication::Package::Manifest::Item]

# File lib/epub/book/features.rb, line 51
def cover_image
  manifest.cover_image || metadata.cover_image
end
default_rendition() click to toggle source

First package in packages @return [Package|nil]

# File lib/epub/book/features.rb, line 31
def default_rendition
  packages.first
end
Also aliased as: package
each_content(&blk) click to toggle source

@overload each_content(&blk)

iterate all items over when block given
@yieldparam item [Publication::Package::Manifest::Item]

@overload each_content

@return [Enumerator] which iterates over all {Publication::Package::Manifest::Item}s in EPUB package when block not given
# File lib/epub/book/features.rb, line 78
def each_content(&blk)
  enum = manifest.items
  if block_given?
    enum.each &blk
  else
    enum.to_enum
  end
end
each_page_on_spine(&blk) click to toggle source

@overload each_page_on_spine(&blk)

iterate over items in order of spine when block given
@yieldparam item [Publication::Package::Manifest::Item]

@overload each_page_on_spine

@return [Enumerator] which iterates over {Publication::Package::Manifest::Item}s in order of spine when block not given
# File lib/epub/book/features.rb, line 60
def each_page_on_spine(&blk)
  enum = package.spine.items
  if block_given?
    enum.each &blk
  else
    enum.each
  end
end
each_page_on_toc(&blk) click to toggle source
# File lib/epub/book/features.rb, line 69
def each_page_on_toc(&blk)
  raise NotImplementedError
end
ocf=(mod) click to toggle source

When writing, sets ocf.book to self. @param [OCF]

# File lib/epub/book/features.rb, line 12
def ocf=(mod)
  @ocf = mod
  mod.book = self
  mod
end
other_navigation() click to toggle source
# File lib/epub/book/features.rb, line 87
def other_navigation
  raise NotImplementedError
end
package()
Alias for: default_rendition
packages() click to toggle source

@return [Array<Publication::Package>]

# File lib/epub/book/features.rb, line 24
def packages
  rootfiles.map(&:package)
end
Also aliased as: renditions
renditions()
Alias for: packages
resources() click to toggle source

@return [Array<Publication::Package::Manifest::Item>] All {Publication::Package::Manifest::Item}s in EPUB package

# File lib/epub/book/features.rb, line 92
def resources
  manifest.items
end
rootfile_path() click to toggle source

Syntax sugar @return String

# File lib/epub/book/features.rb, line 98
def rootfile_path
  ocf.container.rootfile.full_path.to_s
end
rootfiles() click to toggle source

@return [Array<OCF::Container::Rootfile>]

# File lib/epub/book/features.rb, line 19
def rootfiles
  ocf.container.rootfiles
end