Class: SportDb::Market::Loader

Inherits:
Object
  • Object
show all
Includes:
LogUtils::Logging, SportDb::Models
Defined in:
lib/sportdb/market/loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(include_path) ⇒ Loader

Returns a new instance of Loader.



15
16
17
# File 'lib/sportdb/market/loader.rb', line 15

def initialize( include_path )
  @include_path = include_path
end

Instance Attribute Details

#include_pathObject (readonly)

Returns the value of attribute include_path.



13
14
15
# File 'lib/sportdb/market/loader.rb', line 13

def include_path
  @include_path
end

Instance Method Details

#load(name) ⇒ Object

load from gem (built-in)



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/sportdb/market/loader.rb', line 19

def load( name ) # load from gem (built-in)
  path = "#{@include_path}/#{name}.rb"

  puts "*** loading data '#{name}' (#{path})..."

  code = File.read_utf8( path )

  load_worker( code )
  
  ## for builtin fixtures use VERSION of gem

  ### Prop.create!( key: "db.#{fixture_name_to_prop_key(name)}.version", value: "sport.market.rb.#{SportDB::Market::VERSION}" )
end