Module: SqliteExt::DbTracksCreatedFunctions
- Included in:
- SQLite3::Database
- Defined in:
- lib/sqlite_ext/db_tracks_created_functions.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_function(name, arity, *other_args, &block) ⇒ Object
-
#function_created?(name) ⇒ Boolean
Given a name, returns true if a function of that hane has been created on the target instance.
Class Method Details
.included(other) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/sqlite_ext/db_tracks_created_functions.rb', line 18 def self.included(other) orig_create_function = other.instance_method(:create_function) other.send :define_method, :create_function, proc{ |name, arity, *other_args, &block| orig_create_function.bind(self).call name, arity, *other_args, &block created_function_names << name_key_from(name) } end |
Instance Method Details
#create_function(name, arity, *other_args, &block) ⇒ Object
11 12 13 14 |
# File 'lib/sqlite_ext/db_tracks_created_functions.rb', line 11 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.
32 33 34 35 |
# File 'lib/sqlite_ext/db_tracks_created_functions.rb', line 32 def function_created?(name) name_key = name_key_from(name) created_function_names.include?(name_key) end |