class GreyscaleRecord::DataStore::Engine

Public Class Methods

new( driver ) click to toggle source
# File lib/greyscale_record/data_store/engine.rb, line 30
def initialize( driver )
  @driver = driver
  @store  = Store.new
end

Public Instance Methods

add_index( name, column ) click to toggle source
# File lib/greyscale_record/data_store/engine.rb, line 51
def add_index( name, column )
  store.table( name ).add_index( column )
end
add_table( name ) click to toggle source
# File lib/greyscale_record/data_store/engine.rb, line 47
def add_table( name )
  load_table! name
end
find( options = {} ) click to toggle source

Read only store. No writes allowed.

# File lib/greyscale_record/data_store/engine.rb, line 37
def find( options = {} )
  table = store.table( options.delete(:_table) )
  if GreyscaleRecord.live_reload
    load_table!( table.name )
  end

  # TODO: this is where all the meat is
  table.find options
end

Private Instance Methods

load_table!( name ) click to toggle source
# File lib/greyscale_record/data_store/engine.rb, line 61
def load_table!( name )
  store.init_table name, @driver.load!( name )
end
store() click to toggle source
# File lib/greyscale_record/data_store/engine.rb, line 57
def store
  @store
end