Class: Datafile::DirPackage::Entry
- Inherits:
-
Object
- Object
- Datafile::DirPackage::Entry
- Defined in:
- lib/sportdb/formats/datafile_package.rb
Instance Method Summary collapse
-
#initialize(pack, path) ⇒ Entry
constructor
A new instance of Entry.
- #name ⇒ Object
- #read ⇒ Object
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
#name ⇒ Object
32 |
# File 'lib/sportdb/formats/datafile_package.rb', line 32 def name() @name; end |
#read ⇒ Object
33 |
# File 'lib/sportdb/formats/datafile_package.rb', line 33 def read() File.open( @path, 'r:utf-8' ) {|f| f.read }; end |