Class: EpubWorm::Metadata

Inherits:
Object
  • Object
show all
Defined in:
lib/epub_worm/metadata.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title: nil, authors: [], language: nil, publisher: nil, description: nil, published_at: nil, subjects: []) ⇒ Metadata

Returns a new instance of Metadata.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/epub_worm/metadata.rb', line 7

def initialize(
  title: nil,
  authors: [],
  language: nil,
  publisher: nil,
  description: nil,
  published_at: nil,
  subjects: []
)
  @title = title
  @authors = authors
  @language = language
  @publisher = publisher
  @description = description
  @published_at = published_at
  @subjects = subjects
end

Instance Attribute Details

#authorsObject

Returns the value of attribute authors.



5
6
7
# File 'lib/epub_worm/metadata.rb', line 5

def authors
  @authors
end

#descriptionObject

Returns the value of attribute description.



5
6
7
# File 'lib/epub_worm/metadata.rb', line 5

def description
  @description
end

#languageObject

Returns the value of attribute language.



5
6
7
# File 'lib/epub_worm/metadata.rb', line 5

def language
  @language
end

#published_atObject

Returns the value of attribute published_at.



5
6
7
# File 'lib/epub_worm/metadata.rb', line 5

def published_at
  @published_at
end

#publisherObject

Returns the value of attribute publisher.



5
6
7
# File 'lib/epub_worm/metadata.rb', line 5

def publisher
  @publisher
end

#subjectsObject

Returns the value of attribute subjects.



5
6
7
# File 'lib/epub_worm/metadata.rb', line 5

def subjects
  @subjects
end

#titleObject

Returns the value of attribute title.



5
6
7
# File 'lib/epub_worm/metadata.rb', line 5

def title
  @title
end

Instance Method Details

#to_hObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/epub_worm/metadata.rb', line 25

def to_h
  {
    title: title,
    authors: authors,
    language: language,
    publisher: publisher,
    description: description,
    published_at: published_at,
    subjects: subjects
  }
end