Class: Bookfile::WorldDef

Inherits:
Database show all
Defined in:
lib/bookfile/database/database.rb

Overview

change to WorldDatabase or DatabaseWorld - why, why not???

Instance Method Summary collapse

Methods inherited from Database

#connect, #setup

Constructor Details

#initialize(db_config) ⇒ WorldDef

check - if it works by default (no initialze specfied)



26
27
28
# File 'lib/bookfile/database/database.rb', line 26

def initialize( db_config )  ## check - if it works by default (no initialze specfied)
  super
end

Instance Method Details

#prepareObject

change to require - why, why not??



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/bookfile/database/database.rb', line 30

def prepare   ## change to require - why, why not??
  puts "setup world: #{@db_config.inspect}"

  res = require 'worlddb/models'

    ## also add to xxxx ???
    ## (possible to include as globals ???? how - Object.send :include ???) or
    ##   Module.send :include ??
    ## find a better check - check for constants defined??? if not define???
    ##  or use constant_missing handler???

  if res == false
    puts "  todo/fix: WorldDb::Models already included ??"
  end
  
  puts "include WorldDb::Models"

  ### check/fix: include as globals/top-level!!! how? possible???
  Builder.send      :include, WorldDb::Models
  PageCtx.send      :include, WorldDb::Models
  HybookHelper.send :include, WorldDb::Models ## constants not accesible (include in module too)
  ## BookCtx.send :include, WorldDb::Models   -- needed for Book context too?? why, why not??
end