class GreyscaleRecord::Drivers::Base

Attributes

root[R]

Public Class Methods

new( root ) click to toggle source
# File lib/greyscale_record/drivers/base.rb, line 7
def initialize( root )
  @root = root
end

Public Instance Methods

load!(object) click to toggle source
# File lib/greyscale_record/drivers/base.rb, line 11
def load!(object)

  raise GreyscaleRecord::Errors::DriverError, "driver needs to define a `root`" unless root
  
  data = load_data(object)
  
  GreyscaleRecord.logger.info "#{object} successfully loaded data"

  data

rescue => e
  GreyscaleRecord.logger.error "#{self.class} failed to load data for #{object}: #{e}`"
  {}
end

Private Instance Methods

load_data() click to toggle source
# File lib/greyscale_record/drivers/base.rb, line 28
def load_data
  raise NotImplementedError, "load_data is not implemented"
end