Class: Dblp::Parser
- Inherits:
-
Object
- Object
- Dblp::Parser
- Defined in:
- lib/dblp/parser.rb
Instance Method Summary collapse
-
#initialize(filename) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
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
#parse ⇒ Object
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 |