class EPUBMaker::Content

EPUBMaker::Content represents a content data for EPUBMaker. EPUBMaker#contents takes an array of Content.

EPUBMaker::Content represents a content data for EPUBMaker. EPUBMaker#contents takes an array of Content.

Attributes

chaptype[RW]

Chapter type (pre/post/part/nil(body))

file[RW]

File path (will accept #<anchor> suffix also)

id[RW]

ID

level[RW]

Header level (from 1)

media[RW]

MIME type

notoc[RW]

Show in TOC? nil:No.

properties[RW]

Properties (EPUB3)

title[RW]

Title

Public Class Methods

initialize(file, id, media, title, level, notoc) click to toggle source
initialize(hash)
Construct Content object by passing a sequence of parameters or hash.
Keys of +hash+ relate with each parameters.
+file+ (or +hash+["file"]) is required. Others are optional.
# File ../../../../../lib/epubmaker/content.rb, line 42
def initialize(fileorhash, id = nil, media = nil, title = nil, level = nil, notoc = nil, properties = nil, chaptype = nil)
  if fileorhash.instance_of?(Hash)
    @id = fileorhash['id']
    @file = fileorhash['file']
    @media = fileorhash['media']
    @title = fileorhash['title']
    @level = fileorhash['level']
    @notoc = fileorhash['notoc']
    @properties = fileorhash['properties'] || []
    @chaptype = fileorhash['chaptype']
  else
    @file = fileorhash
    @id = id
    @media = media
    @title = title
    @level = level
    @notoc = notoc
    @properties = properties || []
    @chaptype = chaptype
  end
  complement
end

Public Instance Methods

==(other) click to toggle source
# File ../../../../../lib/epubmaker/content.rb, line 65
def ==(other)
  return false unless self.class == other.class
  [self.id, self.file, self.media, self.title, self.level, self.notoc, self.chaptype, self.properties] ==
    [other.id, other.file, other.media, other.title, other.level, other.notoc, other.chaptype, other.properties]
end
inspect() click to toggle source
# File ../../../../../lib/epubmaker/content.rb, line 32
def inspect
  "<Content id=#{@id}, file=#{@file}, media=#{@media}, title=#{@title}, level=#{@level}, notoc=#{@notoc}, properties=#{@properties}, chaptype=#{@chaptype}>"
end