Sha256: 0c3aadffcfb244389a24ada0227a17e0bd05901e697b12792aa1c375c1d994fb

Contents?: true

Size: 476 Bytes

Versions: 1

Compression:

Stored size: 476 Bytes

Contents

module Eader
   class Document
    attr_reader :path, :file, :doc

    def initialize(path)
      @path = path
      @file = File.open(path)
      @doc  = xml_doc_class.parse(file)
    end

    def content
      file.rewind
      file.read
    end

    def items
      dsc_levels.map do |d|
        Item.new(d.css('did'))
      end
    end

    def dsc_levels
      doc.css('dsc c01')
    end

    private
    def xml_doc_class
      Nokogiri::XML::Document
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eader-0.0.1 lib/eader/document.rb