class Djoini::IniLoader
Handles load of ini type files.
Attributes
path[RW]
Public Class Methods
new(path)
click to toggle source
# File lib/djoini/loaders/ini_loader.rb, line 8 def initialize(path) self.path = path end
Public Instance Methods
load_files(array)
click to toggle source
Accepts array of [ { model: name, file: File },.. ]
# File lib/djoini/loaders/ini_loader.rb, line 13 def load_files(array) array.each do |fixture| _model_table = Table.new(name: fixture[:model]) _data = parse_ini(fixture[:file]) _data.to_hash.each do |_, obj| _model_table.insert(obj) end end end
Private Instance Methods
parse_ini(file)
click to toggle source
# File lib/djoini/loaders/ini_loader.rb, line 29 def parse_ini(file) IniParse.parse(File.read(File.join(path, file))) end