module SqliteExt::DbAutoCreatesRegisteredFunctions

Public Class Methods

included(other) click to toggle source
# File lib/sqlite_ext/db_auto_creates_registered_functions.rb, line 26
def self.included(other)
  orig_initialize = other.instance_method(:initialize)

  other.send :define_method, :initialize, proc{ |file, *other_init_args, &block|
    if block
      orig_initialize.bind(self).call file, *other_init_args do
        SqliteExt.enhance_db_session self
        block.call self
      end
    else
      orig_initialize.bind(self).call file, *other_init_args
      SqliteExt.enhance_db_session self
    end
  }
end
new(file, *other_init_args) { |self| ... } click to toggle source
Calls superclass method
# File lib/sqlite_ext/db_auto_creates_registered_functions.rb, line 12
def initialize(file, *other_init_args)
  if block_given?
    super file, *other_init_args do
      SqliteExt.enhance_db_session self
      yield self
    end
  else
    super
    SqliteExt.enhance_db_session self
  end
end