Class: ReVIEW::LaTeXIndex

Inherits:
Object show all
Defined in:
lib/review/latexindex.rb

Instance Method Summary collapse

Constructor Details

#initialize(table) ⇒ LaTeXIndex

Returns a new instance of LaTeXIndex.



21
22
23
# File 'lib/review/latexindex.rb', line 21

def initialize(table)
  @table = table
end

Instance Method Details

#[](key) ⇒ Object



25
26
27
# File 'lib/review/latexindex.rb', line 25

def [](key)
  @table.fetch(key)
end

#load(path) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/review/latexindex.rb', line 12

def load(path)
  table = {}
  File.foreach(path) do |line|
    key, value = *line.strip.split(/\t+/, 2)
    table[key.sub(/\A%/, '')] = value
  end
  new(table)
end