Class: EPUBMaker::Content
Overview
EPUBMaker::Content represents a content data for EPUBMaker. EPUBMaker#contents takes an array of Content.
Instance Attribute Summary collapse
-
#chaptype ⇒ Object
Chapter type (pre/post/part/nil(body)).
-
#file ⇒ Object
File path (will accept #<anchor> suffix also).
-
#id ⇒ Object
ID.
-
#level ⇒ Object
Header level (from 1).
-
#media ⇒ Object
MIME type.
-
#notoc ⇒ Object
Show in TOC? nil:No.
-
#properties ⇒ Object
Properties (EPUB3).
-
#title ⇒ Object
Title.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(fileorhash, id = nil, media = nil, title = nil, level = nil, notoc = nil, properties = nil, chaptype = nil) ⇒ Content
constructor
:call-seq: initialize(file, id, media, title, level, notoc) initialize(hash) Construct Content object by passing a sequence of parameters or hash.
Constructor Details
#initialize(fileorhash, id = nil, media = nil, title = nil, level = nil, notoc = nil, properties = nil, chaptype = nil) ⇒ Content
:call-seq:
initialize(file, id, media, title, level, notoc)
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.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/epubmaker/content.rb', line 40 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 |
Instance Attribute Details
#chaptype ⇒ Object
Chapter type (pre/post/part/nil(body))
32 33 34 |
# File 'lib/epubmaker/content.rb', line 32 def chaptype @chaptype end |
#file ⇒ Object
File path (will accept #<anchor> suffix also)
20 21 22 |
# File 'lib/epubmaker/content.rb', line 20 def file @file end |
#level ⇒ Object
Header level (from 1)
26 27 28 |
# File 'lib/epubmaker/content.rb', line 26 def level @level end |
#notoc ⇒ Object
Show in TOC? nil:No.
28 29 30 |
# File 'lib/epubmaker/content.rb', line 28 def notoc @notoc end |
#properties ⇒ Object
Properties (EPUB3)
30 31 32 |
# File 'lib/epubmaker/content.rb', line 30 def properties @properties end |
Instance Method Details
#==(other) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/epubmaker/content.rb', line 63 def ==(other) if self.class != other.class return false end [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 |