Module: SqliteExt::DbMethodPrepends

Included in:
SQLite3::Database
Defined in:
lib/sqlite_ext/db_method_prepends.rb

Instance Method Summary collapse

Instance Method Details

#create_function(name, arity, *other_args, &block) ⇒ Object



22
23
24
25
# File 'lib/sqlite_ext/db_method_prepends.rb', line 22

def create_function(name, arity, *other_args, &block)
  super
  created_function_names << name_key_from(name)
end

#function_created?(name) ⇒ Boolean

Given a name, returns true if a function of that hane has been created on the target instance. The name lookup is case-insensitive, and either a string or a symbol may be supplied.

Returns:

  • (Boolean)


31
32
33
34
# File 'lib/sqlite_ext/db_method_prepends.rb', line 31

def function_created?(name)
  name_key = name_key_from(name)
  created_function_names.include?(name_key)
end

#initialize(file, *other_init_args) ⇒ Object

Adds functions registered with SqliteExt to each new instance before it is returned from ‘.new` or `.open`or is passed to the given block.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/sqlite_ext/db_method_prepends.rb', line 10

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