Class: EPUB::Publication::Package::Metadata::Identifier

Inherits:
DCMES
  • Object
show all
Defined in:
lib/epub/publication/package/metadata.rb

Constant Summary

Constants included from Refinee

Refinee::PROPERTIES

Instance Attribute Summary collapse

Attributes inherited from DCMES

#content, #dir, #id, #lang

Attributes included from Refinee

#refiners

Instance Method Summary collapse

Methods inherited from DCMES

#to_s

Instance Attribute Details

#schemeObject

TODO:

Define and include OPF module for opf:scheme attribute

TODO:

Define generale way to handle with identifier-type refiners

Note:

This is ad-hoc


98
99
100
# File 'lib/epub/publication/package/metadata.rb', line 98

def scheme
  @scheme
end

Instance Method Details

#isbn?Boolean

TODO:

Define and include OPF module for opf:scheme attribute

TODO:

Define generale way to handle with identifier-type refiners

Note:

This is ad-hoc

Returns:

  • (Boolean)

103
104
105
106
107
108
109
110
111
# File 'lib/epub/publication/package/metadata.rb', line 103

def isbn?
  refiners.any? {|refiner|
    refiner.property == 'identifier-type' and
    refiner.scheme == 'onix:codelist5' and
    %w[02 15].include? refiner.content
  } or
  scheme == 'ISBN' or
  content.to_s.downcase.start_with? 'urn:isbn'
end