### Home Classes Methods

### In Files

- lib/amalgalite/sqlite3/database/function.rb

### Parent

Object

### Methods

- ::new
- ::signature
- #arity
- #call
- #signature
- #to_s

### Files

- HISTORY.rdoc
- LICENSE
- README.rdoc

### Class/Module Index

Quicksearch

- Amalgalite
- Amalgalite::Aggregate
- Amalgalite::Blob
- Amalgalite::Blob::Error
- Amalgalite::Boolean
- Amalgalite::BusyHandler
- Amalgalite::BusyTimeout
- Amalgalite::CSVTableImporter
- Amalgalite::Column
- Amalgalite::Database
- Amalgalite::Database::AggregateError
- Amalgalite::Database::BusyHandlerError
- Amalgalite::Database::FunctionError
- Amalgalite::Database::InvalidModeError
- Amalgalite::Database::ProgressHandlerError
- Amalgalite::Database::TransactionBehavior
- Amalgalite::Error
- Amalgalite::Function
- Amalgalite::Index
- Amalgalite::MemoryDatabase
- Amalgalite::Packer
- Amalgalite::Paths
- Amalgalite::ProfileSampler
- Amalgalite::ProfileTap
- Amalgalite::ProgressHandler
- Amalgalite::Requires
- Amalgalite::SQLite3
- Amalgalite::SQLite3::Constants
- Amalgalite::SQLite3::Constants::Config
- Amalgalite::SQLite3::Constants::DBStatus
- Amalgalite::SQLite3::Constants::DataType
- Amalgalite::SQLite3::Constants::Helpers
- Amalgalite::SQLite3::Constants::Open
- Amalgalite::SQLite3::Constants::ResultCode
- Amalgalite::SQLite3::Constants::StatementStatus
- Amalgalite::SQLite3::Constants::Status
- Amalgalite::SQLite3::Database
- Amalgalite::SQLite3::Database::DBStatus
- Amalgalite::SQLite3::Database::Function
- Amalgalite::SQLite3::Database::Stat
- Amalgalite::SQLite3::Stat
- Amalgalite::SQLite3::Status
- Amalgalite::SQLite3::Version
- Amalgalite::Schema
- Amalgalite::Statement
- Amalgalite::Table
- Amalgalite::Taps
- Amalgalite::Taps::IO
- Amalgalite::Taps::Stderr
- Amalgalite::Taps::Stdout
- Amalgalite::Taps::StringIO
- Amalgalite::TraceTap
- Amalgalite::TypeMap
- Amalgalite::TypeMaps
- Amalgalite::TypeMaps::DefaultMap
- Amalgalite::TypeMaps::StorageMap
- Amalgalite::TypeMaps::TextMap
- Amalgalite::Version
- Amalgalite::View
- Kernel
- Object

No matching classes.

# Amalgalite::SQLite3::Database::Function

A wrapper around a proc for use as an SQLite Ddatabase fuction

    f = Function.new( 'md5', lambda { |x| Digest::MD5.hexdigest( x.to_s ) } )

### Attributes

name[R]

the name of the function, and how it will be called in SQL

### Public Class Methods

new( name, _proc ) click to toggle source

Initialize with the name and the Proc

    # File lib/amalgalite/sqlite3/database/function.rb, line 22
    def initialize( name, _proc )
      @name = name
      @function = _proc
    end

signature( name, arity ) click to toggle source

The unique signature of this function. This is used to determin if the function is already registered or not

    # File lib/amalgalite/sqlite3/database/function.rb, line 16
    def self.signature( name, arity )
      "#{name}/#{arity}"
    end

### Public Instance Methods

arity() click to toggle source

The arity of SQL function, -1 means it is takes a variable number of arguments.

    # File lib/amalgalite/sqlite3/database/function.rb, line 37
    def arity
      @function.arity
    end

call( *args ) click to toggle source

Invoke the proc

    # File lib/amalgalite/sqlite3/database/function.rb, line 43
    def call( *args )
      @function.call( *args )
    end

signature() click to toggle source

The unique signature of this function

    # File lib/amalgalite/sqlite3/database/function.rb, line 29
    def signature
      @signature ||= Function.signature( name, arity )
    end

Also aliased as: to_s
to_s() click to toggle source
Alias for: signature

[Validate]

Generated with the Darkfish Rdoc Generator 2.