Class: Inform::Database
Overview
The Database abstraction class
Constant Summary collapse
- REGISTRY =
Struct.new(:memo).new(defined?(Java) ? java.util.concurrent.ConcurrentHashMap.new : {})
Instance Attribute Summary collapse
-
#bootstrap ⇒ Object
readonly
Returns the value of attribute bootstrap.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(database_name) ⇒ Database
constructor
A new instance of Database.
Constructor Details
#initialize(database_name) ⇒ Database
Returns a new instance of Database.
483 484 485 486 487 488 489 490 |
# File 'lib/runtime/database.rb', line 483 def initialize(env = Game.environment) log.debug "Initializing persistence layer for environment: #{env}" log.debug caller[0..4] env ||= environment @config = database_config.fetch(env.to_s, {}) establish_database_connection enable_plugins end |
Instance Attribute Details
#bootstrap ⇒ Object (readonly)
Returns the value of attribute bootstrap.
465 466 467 |
# File 'lib/runtime/database.rb', line 465 def bootstrap @bootstrap end |
Class Method Details
.init(database_name) ⇒ Object
467 468 469 |
# File 'lib/runtime/database.rb', line 467 def self.init(database_name) Inform::Database.instance(database_name) end |
.instance(*args) ⇒ Object
473 474 475 476 477 478 479 |
# File 'lib/runtime/database.rb', line 473 def self.instance(*args) return @instance unless @instance.nil? @instance_mutex.synchronize do @instance ||= new(*args) end @instance end |