Class: EPUBInfo::Models::Person

Inherits:
Object
  • Object
show all
Defined in:
lib/epubinfo/models/person.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_asString

File as (EPUB2 reference)

Returns:

  • (String)


9
10
11
# File 'lib/epubinfo/models/person.rb', line 9

def file_as
  @file_as
end

#nameString

Returns:

  • (String)


6
7
8
# File 'lib/epubinfo/models/person.rb', line 6

def name
  @name
end

#roleString

Returns:

  • (String)


12
13
14
# File 'lib/epubinfo/models/person.rb', line 12

def role
  @role
end

Instance Method Details

#to_hashHash

Returns Hash representation of a person

Returns:

  • (Hash)


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