Sha256: f7557c45b351c276767890ea60ee1b36abbe2127292df83a76a9ecc48c4d93a4
Contents?: true
Size: 1.1 KB
Versions: 83
Compression:
Stored size: 1.1 KB
Contents
module Amalgalite::SQLite3 class Database ## # A wrapper around a proc for use as an SQLite Ddatabase fuction # # f = Function.new( 'md5', lambda { |x| Digest::MD5.hexdigest( x.to_s ) } ) # class Function # the name of the function, and how it will be called in SQL attr_reader :name # The unique signature of this function. This is used to determin if the # function is already registered or not # def self.signature( name, arity ) "#{name}/#{arity}" end # Initialize with the name and the Proc # def initialize( name, _proc ) @name = name @function = _proc end # The unique signature of this function # def signature @signature ||= Function.signature( name, arity ) end alias :to_s :signature # The arity of SQL function, -1 means it is takes a variable number of # arguments. # def arity @function.arity end # Invoke the proc # def call( *args ) @function.call( *args ) end end end end
Version data entries
83 entries across 83 versions & 2 rubygems