Class: EPUBInfo::Models::Identifier

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ Identifier

Should never be called directly, go through EPUBInfo.get



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

def initialize(node)
  self.identifier = node.content
  self.scheme = node.attribute('scheme').content rescue nil
end

Instance Attribute Details

#identifierString

Identifier (EPUB2 reference)

Returns:

  • (String)


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

def identifier
  @identifier
end

#schemeString

Scheme (EPUB2 reference)

Returns:

  • (String)


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

def scheme
  @scheme
end

Instance Method Details

#to_hashHash

Returns Hash representation of an identifier

Returns:

  • (Hash)


19
20
21
22
23
24
# File 'lib/epubinfo/models/identifier.rb', line 19

def to_hash
  {
    :identifier => @identifier,
    :scheme => @scheme
  }
end