Sha256: a92d4ce48c1cb9622de814cf239eea24367c3f89c9ea81f7395f1a51e87f4f07

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

#!/usr/bin/env ruby

# An example of requiring all the files in a table via the Bootstrap::lift
# method.
#
# First use the blob.rb example in this same directory to load the a.rb file
# into an example database:
#
#   ruby blob.rb store a.rb
#
# Then run this example.
#

# Require "ONLY" then binary extension, do not +require+ the ruby based code
$: << "../ext"
require 'amalgalite3'

# See what the load path is, notice that it is very small
puts "Before $\" : #{$".inspect}"

# tell the binary extension to "require" every file in the filestore.db in the
# table 'files' orderd by column 'id'.  The 'path' column is added to $" and the
# code in 'data' is evaled.
Amalgalite::Requires::Bootstrap.lift( "dbfile"          => "filestore.db", 
                                      "table_name"      => "files", 
                                      "rowid_column"    => "id", 
                                      "filename_column" => "path", 
                                      "contents_column" => "data" )

# Notice that a.rb is in the list of files that has been required
puts "After $\" : #{$".inspect}"

# and look we prove that the code was eval'd appropriately
a = A.new
a.a

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
amalgalite-0.4.0 examples/bootstrap.rb
amalgalite-0.4.2-x86-mswin32-60 examples/bootstrap.rb
amalgalite-0.4.1 examples/bootstrap.rb
amalgalite-0.4.2 examples/bootstrap.rb