sportdb-market 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -13,6 +13,7 @@ db/cl/2012_13/cl_quotes_betathome.txt
13
13
  db/cl/2012_13/cl_quotes_tipp3.txt
14
14
  db/services.rb
15
15
  db/world/quali_quotes_tipp3.txt
16
+ lib/sportdb/market/loader.rb
16
17
  lib/sportdb/market/market.rb
17
18
  lib/sportdb/market/models/event_quote.rb
18
19
  lib/sportdb/market/models/game.rb
@@ -0,0 +1,38 @@
1
+ module SportDB::Market
2
+
3
+ class Loader
4
+
5
+ ## make models available in sportdb module by default with namespace
6
+ # e.g. lets you use Team instead of Models::Team
7
+ include SportDB::Models
8
+
9
+
10
+ def initialize( logger=nil )
11
+ if logger.nil?
12
+ @logger = Logger.new(STDOUT)
13
+ @logger.level = Logger::INFO
14
+ else
15
+ @logger = logger
16
+ end
17
+ end
18
+
19
+ attr_reader :logger
20
+
21
+ def load_builtin( name ) # load from gem (built-in)
22
+ path = "#{SportDB::Market.root}/db/#{name}.rb"
23
+
24
+ puts "*** loading data '#{name}' (#{path})..."
25
+
26
+ code = File.read( path )
27
+
28
+ load_worker( code )
29
+ end
30
+
31
+
32
+ private
33
+ def load_worker( code )
34
+ self.class_eval( code )
35
+ end
36
+
37
+ end # class Loader
38
+ end # module SportDB::Market
@@ -11,6 +11,7 @@ require 'sportdb/market/models/service'
11
11
  require 'sportdb/market/models/group_quote'
12
12
  require 'sportdb/market/models/event_quote'
13
13
  require 'sportdb/market/models/game'
14
+ require 'sportdb/market/loader'
14
15
  require 'sportdb/market/reader'
15
16
 
16
17
 
@@ -20,8 +21,9 @@ module SportDB::Market
20
21
  "sportdb-market #{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
21
22
  end
22
23
 
24
+ ## cut off folders lib(#1)/sportdb(#2)/market(#3) to get to root
23
25
  def self.root
24
- "#{File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )}"
26
+ "#{File.expand_path( File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) )}"
25
27
  end
26
28
 
27
29
  puts "SportDB::Market.banner: >>#{SportDB::Market.banner}<<"
@@ -2,5 +2,5 @@
2
2
  module SportDB ; end # forward reference (for hoe require)
3
3
 
4
4
  module SportDB::Market
5
- VERSION = '0.0.5'
5
+ VERSION = '0.0.6'
6
6
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportdb-market
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gerald Bauer
@@ -78,6 +78,7 @@ files:
78
78
  - db/cl/2012_13/cl_quotes_tipp3.txt
79
79
  - db/services.rb
80
80
  - db/world/quali_quotes_tipp3.txt
81
+ - lib/sportdb/market/loader.rb
81
82
  - lib/sportdb/market/market.rb
82
83
  - lib/sportdb/market/models/event_quote.rb
83
84
  - lib/sportdb/market/models/game.rb