Module: SportDB::Market
- Defined in:
- lib/sportdb/market/version.rb,
lib/sportdb/market/schema.rb,
lib/sportdb/market/reader.rb,
lib/sportdb/market/loader.rb,
lib/sportdb/market.rb
Defined Under Namespace
Classes: CreateDB, Deleter, Loader, Reader
Constant Summary collapse
- VERSION =
'0.2.0'
Class Method Summary collapse
- .banner ⇒ Object
- .create ⇒ Object
-
.delete! ⇒ Object
delete ALL records (use with care!).
-
.fixtures_rb ⇒ Object
all builtin ruby fixtures; helper for covenience.
- .fixtures_txt ⇒ Object
-
.load(ary) ⇒ Object
load built-in (that is, bundled within the gem) named seeds - pass in an array of seed names e.g.
- .load_all ⇒ Object
-
.read(ary) ⇒ Object
load built-in (that is, bundled within the gem) named plain text seeds - pass in an array of pairs of event/seed names e.g.
- .read_all ⇒ Object
-
.root ⇒ Object
cut off folders lib(#1)/sportdb(#2) to get to root.
Class Method Details
.banner ⇒ Object
22 23 24 |
# File 'lib/sportdb/market.rb', line 22 def self. "sportdb-market #{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]" end |
.delete! ⇒ Object
delete ALL records (use with care!)
104 105 106 107 |
# File 'lib/sportdb/market.rb', line 104 def self.delete! puts '*** deleting sport market table records/data...' Deleter.new.run end |
.fixtures_rb ⇒ Object
all builtin ruby fixtures; helper for covenience
36 37 38 39 40 41 42 |
# File 'lib/sportdb/market.rb', line 36 def self.fixtures_rb # all builtin ruby fixtures; helper for covenience ['services', 'at/2012_13/bl', 'at/2012_13/cup', 'cl/2012_13/cl', 'euro/2012'] end |
.fixtures_txt ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/sportdb/market.rb', line 48 def self.fixtures_txt [['betathome', 'at.2012/13', 'at/2012_13/bl_betathome'], ['tipp3', 'at.2012/13', 'at/2012_13/bl_tipp3'], ['betathome', 'at.cup.2012/13', 'at/2012_13/cup_betathome'], ['tipp3', 'at.cup.2012/13', 'at/2012_13/cup_tipp3'], ['betathome', 'cl.2012/13', 'cl/2012_13/cl_betathome'], ['tipp3', 'cl.2012/13', 'cl/2012_13/cl_tipp3'], ['tipico', 'euro.2012', 'euro/2012_tipico'], ['tipp3', 'euro.2012', 'euro/2012_tipp3' ], ['tipp3', 'world.quali.euro.2012/13', 'world/quali_tipp3']] end |
.load(ary) ⇒ Object
load built-in (that is, bundled within the gem) named seeds
-
pass in an array of seed names e.g. [ ‘cl/teams’, ‘cl/2012_13/cl’ ] etc.
68 69 70 71 72 73 |
# File 'lib/sportdb/market.rb', line 68 def self.load( ary ) loader = Loader.new ary.each do |name| loader.load_builtin( name ) end end |
.load_all ⇒ Object
44 45 46 |
# File 'lib/sportdb/market.rb', line 44 def self.load_all load( fixtures_rb ) end |
.read(ary) ⇒ Object
load built-in (that is, bundled within the gem) named plain text seeds
-
pass in an array of pairs of event/seed names e.g. [[‘at.2012/13’, ‘at/2012_13/bl’], [‘cl.2012/13’, ‘cl/2012_13/cl’]] etc.
78 79 80 81 82 83 |
# File 'lib/sportdb/market.rb', line 78 def self.read( ary ) reader = Reader.new ary.each do |rec| reader.load_builtin( rec[0], rec[1], rec[2] ) # service_key, event_key, name end end |
.read_all ⇒ Object
60 61 62 |
# File 'lib/sportdb/market.rb', line 60 def self.read_all read( fixtures_txt ) end |
.root ⇒ Object
cut off folders lib(#1)/sportdb(#2) to get to root
27 28 29 |
# File 'lib/sportdb/market.rb', line 27 def self.root "#{File.( File.dirname(File.dirname(File.dirname(__FILE__))) )}" end |