Class: ComfortableMexicanSofa::Seeds::Layout::Importer

Inherits:
Importer
  • Object
show all
Defined in:
lib/comfortable_mexican_sofa/seeds/layout/importer.rb

Instance Attribute Summary

Attributes inherited from Importer

#from, #path, #seed_ids, #site, #to

Instance Method Summary collapse

Constructor Details

#initialize(from, to = from) ⇒ Importer

Returns a new instance of Importer.



4
5
6
7
# File 'lib/comfortable_mexican_sofa/seeds/layout/importer.rb', line 4

def initialize(from, to = from)
  super
  self.path = ::File.join(ComfortableMexicanSofa.config.seeds_path, from, "layouts/")
end

Instance Method Details

#import!(path = self.path, parent = nil) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/comfortable_mexican_sofa/seeds/layout/importer.rb', line 9

def import!(path = self.path, parent = nil)
  Dir["#{path}*/"].each do |path|
    import_layout(path, nil)
  end

  # cleaning up
  self.site.layouts.where("id NOT IN (?)", self.seed_ids).destroy_all
end