Class: Occams::Seeds::Exporter

Inherits:
Object
  • Object
show all
Defined in:
lib/occams/seeds.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from, to = from) ⇒ Exporter

Returns a new instance of Exporter.



75
76
77
78
79
# File 'lib/occams/seeds.rb', line 75

def initialize(from, to = from)
  self.from = from
  self.to   = to
  self.site = Occams::Cms::Site.where(identifier: from).first!
end

Instance Attribute Details

#fromObject

Returns the value of attribute from.



70
71
72
# File 'lib/occams/seeds.rb', line 70

def from
  @from
end

#pathObject

Returns the value of attribute path.



70
71
72
# File 'lib/occams/seeds.rb', line 70

def path
  @path
end

#siteObject

Returns the value of attribute site.



70
71
72
# File 'lib/occams/seeds.rb', line 70

def site
  @site
end

#toObject

Returns the value of attribute to.



70
71
72
# File 'lib/occams/seeds.rb', line 70

def to
  @to
end

Instance Method Details

#export!(classes = nil) ⇒ Object

if passed nil will use default seed classes



82
83
84
85
86
87
88
# File 'lib/occams/seeds.rb', line 82

def export!(classes = nil)
  classes ||= SEED_CLASSES
  classes.each do |klass|
    klass = "Occams::Seeds::#{klass}::Exporter"
    klass.constantize.new(from, to).export!
  end
end