Class: EPUBInfo::Models::Person
- Inherits:
-
Object
- Object
- EPUBInfo::Models::Person
- Defined in:
- lib/epubinfo/models/person.rb
Instance Attribute Summary collapse
-
#file_as ⇒ String
File as (EPUB2 reference).
-
#name ⇒ String
Name (EPUB2 reference).
-
#role ⇒ String
Role (EPUB2 reference).
Instance Method Summary collapse
-
#initialize(node) ⇒ Person
constructor
Should never be called directly, go through EPUBInfo.get.
-
#to_hash ⇒ Hash
Returns Hash representation of a person.
Constructor Details
#initialize(node) ⇒ Person
Should never be called directly, go through EPUBInfo.get
15 16 17 18 19 |
# File 'lib/epubinfo/models/person.rb', line 15 def initialize(node) self.name = node.content self.file_as = node.attribute('file-as').content rescue nil self.role = node.attribute('role').content rescue nil end |
Instance Attribute Details
#file_as ⇒ String
File as (EPUB2 reference)
9 10 11 |
# File 'lib/epubinfo/models/person.rb', line 9 def file_as @file_as end |
#name ⇒ String
Name (EPUB2 reference)
6 7 8 |
# File 'lib/epubinfo/models/person.rb', line 6 def name @name end |
#role ⇒ String
Role (EPUB2 reference)
12 13 14 |
# File 'lib/epubinfo/models/person.rb', line 12 def role @role end |
Instance Method Details
#to_hash ⇒ Hash
Returns Hash representation of a person
23 24 25 26 27 28 29 |
# File 'lib/epubinfo/models/person.rb', line 23 def to_hash { :name => @name, :file_as => @file_as, :role => @role } end |