Class: KindleClippings::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/kindleclippings/parser.rb

Instance Method Summary collapse

Instance Method Details

#parse(filecontent) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/kindleclippings/parser.rb', line 12

def parse(filecontent)
  @clippings = ClippingResult.new

  filecontent.split("=" * 10).each do |clipping|

    a_clipping = parse_clipping(clipping)

    if a_clipping
      @clippings << a_clipping
    end


  end
  @clippings
end

#parse_file(path) ⇒ Object



6
7
8
9
10
# File 'lib/kindleclippings/parser.rb', line 6

def parse_file(path)
  file_content = open(path, 'r:utf-8').read

  parse(file_content)
end