lib/sportdb/readers/season.rb in sportdb-1.9.8 vs lib/sportdb/readers/season.rb in sportdb-1.9.9
- old
+ new
@@ -10,19 +10,32 @@
## make models available by default with namespace
# e.g. lets you use Usage instead of Model::Usage
include Models
- attr_reader :include_path
+ def self.from_zip( zip_file, entry_path )
+ ## to be done
+ end
-
- def initialize( include_path, opts = {} )
- @include_path = include_path
+ def self.from_file( path )
+ ## note: assume/enfore utf-8 encoding (with or without BOM - byte order mark)
+ ## - see textutils/utils.rb
+ text = File.read_utf8( path )
+ self.from_string( text )
end
+ def self.from_string( text )
+ SeasonReader.new( text )
+ end
- def read( name, more_attribs={} )
- reader = LineReaderV2.new( name, include_path )
+
+ def initialize( text )
+ ## todo/fix: how to add opts={} ???
+ @text = text
+ end
+
+ def read()
+ reader = LineReader.from_string( @text )
####
## fix!!!!!
## use Season.create_or_update_from_hash or similar
## use Season.create_or_update_from_hash_reader?? or similar