Class: Dblp::Parser

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

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ Parser

Returns a new instance of Parser.



5
6
7
8
# File 'lib/dblp/parser.rb', line 5

def initialize(filename)
  @filename = filename
  @map = {}
end

Instance Method Details

#parseObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/dblp/parser.rb', line 10

def parse
  File.readlines(@filename).inject([]) {|m, l|
      cnt = l.match(/\\citation\{(.*?)\}/)
      
      if cnt
        cnt[1].split(",").each do |t|
          m << t.strip
        end
      end
      m
    }.uniq
end