Sha256: b49ac1fd0670206f78df85e8c86a8e51c380509c7eeacc7f1b5f21698d7616a2

Contents?: true

Size: 981 Bytes

Versions: 21

Compression:

Stored size: 981 Bytes

Contents

module EPUBInfo
  module Models
    class Person
      # Name ({http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.2.6 EPUB2 reference})
      # @return [String]
      attr_accessor :name
      # File as ({http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.2.6 EPUB2 reference})
      # @return [String]
      attr_accessor :file_as
      # Role ({http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.2.6 EPUB2 reference})
      # @return [String]
      attr_accessor :role

      # Should never be called directly, go through EPUBInfo.get
      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

      # Returns Hash representation of a person
      # @return [Hash]
      def to_hash
        {
          :name => @name,
          :file_as => @file_as,
          :role => @role
        }
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
epubinfo_with_toc-0.5.7 lib/epubinfo/models/person.rb
epubinfo-0.4.4 lib/epubinfo/models/person.rb
epubinfo_with_toc-0.5.6 lib/epubinfo/models/person.rb
epubinfo_with_toc-0.5.5 lib/epubinfo/models/person.rb
epubinfo_with_toc-0.5.4 lib/epubinfo/models/person.rb
epubinfo_with_toc-0.5.2 lib/epubinfo/models/person.rb
epubinfo_with_toc-0.5.0 lib/epubinfo/models/person.rb
epubinfo_with_toc-0.4.5 lib/epubinfo/models/person.rb
epubinfo-0.4.3 lib/epubinfo/models/person.rb
epubinfo-0.4.2 lib/epubinfo/models/person.rb
epubinfo-0.4.1 lib/epubinfo/models/person.rb
epubinfo-0.4.0 lib/epubinfo/models/person.rb
epubinfo-0.3.6 lib/epubinfo/models/person.rb
epubinfo-0.3.5 lib/epubinfo/models/person.rb
epubinfo-0.3.4 lib/epubinfo/models/person.rb
epubinfo-0.3.3 lib/epubinfo/models/person.rb
epubinfo-0.3.2 lib/epubinfo/models/person.rb
epubinfo-0.3.1 lib/epubinfo/models/person.rb
epubinfo-0.3.0 lib/epubinfo/models/person.rb
epubinfo-0.2.4 lib/epubinfo/models/person.rb