Class: Datafile::DirPackage::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/sportdb/formats/datafile_package.rb

Instance Method Summary collapse

Constructor Details

#initialize(pack, path) ⇒ Entry

Returns a new instance of Entry.



23
24
25
26
27
28
29
30
31
# File 'lib/sportdb/formats/datafile_package.rb', line 23

def initialize( pack, path )
  @pack = pack  ## parent package
  @path = path
  ## note: calculate name (cut-off pack.path!!!), that is, make path relative (to pack)
  ##   e.g.
  ##    ../../../openfootball/austria/2011-12/1-bundesliga-i.txt
  ##      becomes =>                  2011-12/1-bundesliga-i.txt
  @name = path[ pack.path.length+1..-1 ]
end

Instance Method Details

#nameObject



32
# File 'lib/sportdb/formats/datafile_package.rb', line 32

def name()  @name; end

#readObject



33
# File 'lib/sportdb/formats/datafile_package.rb', line 33

def read()  File.open( @path, 'r:utf-8' ) {|f| f.read }; end