Class: GreyscaleRecord::DataStore::Engine

Inherits:
Object
  • Object
show all
Defined in:
lib/greyscale_record/data_store/engine.rb

Instance Method Summary collapse

Constructor Details

#initialize(driver) ⇒ Engine

Returns a new instance of Engine.



30
31
32
33
# File 'lib/greyscale_record/data_store/engine.rb', line 30

def initialize( driver )
  @driver = driver
  @store  = Store.new
end

Instance Method Details

#add_index(name, column) ⇒ Object



51
52
53
# 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) ⇒ Object



47
48
49
# File 'lib/greyscale_record/data_store/engine.rb', line 47

def add_table( name )
  load_table! name
end

#find(options = {}) ⇒ Object

Read only store. No writes allowed.



37
38
39
40
41
42
43
44
45
# 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