Class: Dvi::LsR
- Inherits:
-
Object
- Object
- Dvi::LsR
- Defined in:
- lib/dvi/lsr.rb
Class Method Summary collapse
Instance Method Summary collapse
- #find(name) ⇒ Object
-
#initialize(texmfdir) ⇒ LsR
constructor
A new instance of LsR.
Constructor Details
#initialize(texmfdir) ⇒ LsR
Returns a new instance of LsR.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/dvi/lsr.rb', line 2 def initialize(texmfdir) @texmfdir = texmfdir @table = Hash.new file = File.open(File.join(texmfdir, "ls-R")) begin current = nil while true do case file.readline when /^%/, /^$/ # do nothing when /^(.*):$/ current = $1 when /^(.+)$/ @table[$1] = Array.new unless @table.has_key? $1 @table[$1] << current end end rescue EOFError file.close end end |
Class Method Details
.default ⇒ Object
32 33 34 |
# File 'lib/dvi/lsr.rb', line 32 def self.default @default end |
.default=(lsr) ⇒ Object
36 37 38 39 |
# File 'lib/dvi/lsr.rb', line 36 def self.default=(lsr) raise ArgumentError unless lsr.kind_of?(self) @default = lsr end |
Instance Method Details
#find(name) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/dvi/lsr.rb', line 24 def find(name) if @table.has_key? name File.join(@texmfdir, @table[name].first, name) else return nil end end |