Module: EPUB::Parser::Utils

Included in:
ContentDocument, OCF, Publication
Defined in:
lib/epub/parser/utils.rb

Class Method Summary collapse

Class Method Details

.extract_attribute(element, name, prefix = nil) ⇒ String

TODO:

Refinement Nokogiri::XML::Node instead of use this method after Ruby 2.0 becomes popular

Extract the value of attribute of element



13
14
15
16
# File 'lib/epub/parser/utils.rb', line 13

def extract_attribute(element, name, prefix=nil)
  attr = element.attribute_with_ns(name, EPUB::NAMESPACES[prefix])
  attr.nil? ? nil : attr.value
end