Class: SQLite3::Database::FunctionProxy
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/sqlite3/database.rb |
Overview
A helper class for dealing with custom functions (see #create_function, #create_aggregate, and #create_aggregate_handler). It encapsulates the opaque function object that represents the current invocation. It also provides more convenient access to the API functions that operate on the function object.
This class will almost always be instantiated indirectly, by working with the create methods mentioned above.
Class Method Summary
-
.new ⇒ FunctionProxy
constructor
Create a new
FunctionProxy
that encapsulates the givenfunc
object.
Instance Attribute Summary
- #result rw
Instance Method Summary
-
#[](key)
Returns the value with the given key from the context.
-
#[]=(key, value)
Sets the value with the given key in the context.
Constructor Details
.new ⇒ FunctionProxy
Create a new FunctionProxy
that encapsulates the given func
object. If context is non-nil, the functions context will be set to that. If it is non-nil, it must quack like a Hash. If it is nil, then none of the context functions will be available.
# File 'lib/sqlite3/database.rb', line 676
def initialize @result = nil @context = {} end
Instance Attribute Details
#result (rw)
[ GitHub ]# File 'lib/sqlite3/database.rb', line 670
attr_accessor :result
Instance Method Details
#[](key)
Returns the value with the given key from the context. This is only available to aggregate functions.
# File 'lib/sqlite3/database.rb', line 683
def [](key) @context[key] end
#[]=(key, value)
Sets the value with the given key in the context. This is only available to aggregate functions.
# File 'lib/sqlite3/database.rb', line 689
def []=(key, value) @context[key] = value end