Sha256: 252ce189b0df3ee6aec385ab2b58989fc7542a63cdd7b8750c93cba2b053d0b5

Contents?: true

Size: 588 Bytes

Versions: 3

Compression:

Stored size: 588 Bytes

Contents

require 'nokogiri'
require 'evernote2org/note'

module Evernote2org
  class Enex
    attr_accessor :path, :notes, :doc

    def initialize(path)
      @path = path
      @notes = []
    end

    def parse!
      File.open(@path) do |file|
        @doc = Nokogiri::XML(file)
        @notes = @doc.css("note").map do |note_content|
          Note.new(note_content)
        end
      end

      self
    end

    def export_to(out_dir)
      @notes.each { |note| note.export_to(out_dir) }
    end

    class << self
      def parse(path)
        new(path).parse!
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
evernote2org-0.1.3 lib/evernote2org/enex.rb
evernote2org-0.1.2 lib/evernote2org/enex.rb
evernote2org-0.1.1 lib/evernote2org/enex.rb