Sha256: cf0d5122c3a38cfbd7bdc9b8c33e8677706880512bc741d717e3e957eaa3ea40

Contents?: true

Size: 780 Bytes

Versions: 21

Compression:

Stored size: 780 Bytes

Contents

module EPUBInfo
  module Models
    class Identifier
      # Identifier ({http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.2.1 EPUB2 reference})
      # @return [String]
      attr_accessor :identifier
      # Scheme ({http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.2.1 EPUB2 reference})
      # @return [String]
      attr_accessor :scheme

      # Should never be called directly, go through EPUBInfo.get
      def initialize(node)
        self.identifier = node.content
        self.scheme = node.attribute('scheme').content rescue nil
      end

      # Returns Hash representation of an identifier
      # @return [Hash]
      def to_hash
        {
          :identifier => @identifier,
          :scheme => @scheme
        }
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
epubinfo-0.2.3 lib/epubinfo/models/identifier.rb