Class: SimpleMaster::Loader::MarshalLoader

Inherits:
SimpleMaster::Loader show all
Defined in:
lib/simple_master/loader/marshal_loader.rb

Instance Attribute Summary

Attributes inherited from SimpleMaster::Loader

#options

Instance Method Summary collapse

Methods inherited from SimpleMaster::Loader

#globalize, #initialize, #load_records

Constructor Details

This class inherits a constructor from SimpleMaster::Loader

Instance Method Details

#build_records(_klass, raw) ⇒ Object



13
14
15
16
17
# File 'lib/simple_master/loader/marshal_loader.rb', line 13

def build_records(_klass, raw)
  return [] if raw.nil?

  Marshal.load(raw) # rubocop:disable Security/MarshalLoad
end

#read_raw(table) ⇒ Object



6
7
8
9
10
11
# File 'lib/simple_master/loader/marshal_loader.rb', line 6

def read_raw(table)
  path = "#{@options[:path]}/#{table.klass.table_name}.marshal"
  return nil unless File.exist?(path)

  File.read(path)
end