Class: Picky::Backends::SQLite
- Defined in:
- lib/picky/backends/sqlite.rb,
lib/picky/backends/sqlite/array.rb,
lib/picky/backends/sqlite/basic.rb,
lib/picky/backends/sqlite/value.rb,
lib/picky/backends/sqlite/string_key_array.rb,
lib/picky/backends/sqlite/integer_key_array.rb,
lib/picky/backends/sqlite/directly_manipulable.rb
Defined Under Namespace
Modules: DirectlyManipulable Classes: Array, Basic, IntegerKeyArray, StringKeyArray, Value
Instance Attribute Summary collapse
-
#realtime ⇒ Object
readonly
Returns the value of attribute realtime.
Instance Method Summary collapse
-
#create_configuration(bundle, _ = nil) ⇒ Object
Returns an object that on #initial, #load returns an object that responds to: [:key] # => value (a value for this config key).
-
#create_inverted(bundle, _ = nil) ⇒ Object
Returns an object that on #initial, #load returns an object that responds to: [:token] # => [id, id, id, id, id] (an array of ids).
-
#create_realtime(bundle, _ = nil) ⇒ Object
Returns an object that on #initial, #load returns an object that responds to: [id] # => [:sym1, :sym2].
-
#create_similarity(bundle, _ = nil) ⇒ Object
Returns an object that on #initial, #load returns an object that responds to: [:encoded] # => [:original, :original] (an array of original symbols this similarity encoded thing maps to).
-
#create_weights(bundle, _ = nil) ⇒ Object
Returns an object that on #initial, #load returns an object that responds to: [:token] # => 1.23 (a weight).
-
#initialize(options = {}) ⇒ SQLite
constructor
A new instance of SQLite.
Methods inherited from Backend
Constructor Details
#initialize(options = {}) ⇒ SQLite
Returns a new instance of SQLite.
9 10 11 12 13 14 15 |
# File 'lib/picky/backends/sqlite.rb', line 9 def initialize = {} @realtime = [:realtime] require 'sqlite3' rescue LoadError => e warn_gem_missing 'sqlite3', 'SQLite bindings' end |
Instance Attribute Details
#realtime ⇒ Object (readonly)
Returns the value of attribute realtime.
7 8 9 |
# File 'lib/picky/backends/sqlite.rb', line 7 def realtime @realtime end |
Instance Method Details
#create_configuration(bundle, _ = nil) ⇒ Object
Returns an object that on #initial, #load returns an object that responds to:
[:key] # => value (a value for this config key)
38 39 40 |
# File 'lib/picky/backends/sqlite.rb', line 38 def create_configuration bundle, _ = nil Value.new bundle.index_path(:configuration), realtime: realtime end |
#create_inverted(bundle, _ = nil) ⇒ Object
Returns an object that on #initial, #load returns an object that responds to:
[:token] # => [id, id, id, id, id] (an array of ids)
20 21 22 |
# File 'lib/picky/backends/sqlite.rb', line 20 def create_inverted bundle, _ = nil StringKeyArray.new bundle.index_path(:inverted), realtime: realtime end |
#create_realtime(bundle, _ = nil) ⇒ Object
Returns an object that on #initial, #load returns an object that responds to:
[id] # => [:sym1, :sym2]
44 45 46 |
# File 'lib/picky/backends/sqlite.rb', line 44 def create_realtime bundle, _ = nil IntegerKeyArray.new bundle.index_path(:realtime), realtime: realtime end |
#create_similarity(bundle, _ = nil) ⇒ Object
Returns an object that on #initial, #load returns an object that responds to:
[:encoded] # => [:original, :original] (an array of original symbols this similarity encoded thing maps to)
32 33 34 |
# File 'lib/picky/backends/sqlite.rb', line 32 def create_similarity bundle, _ = nil StringKeyArray.new bundle.index_path(:similarity), realtime: realtime end |
#create_weights(bundle, _ = nil) ⇒ Object
Returns an object that on #initial, #load returns an object that responds to:
[:token] # => 1.23 (a weight)
26 27 28 |
# File 'lib/picky/backends/sqlite.rb', line 26 def create_weights bundle, _ = nil Value.new bundle.index_path(:weights), realtime: realtime end |