Class: ComfortableMexicanSofa::Seeds::Exporter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from, to = from) ⇒ Exporter

Returns a new instance of Exporter.


79
80
81
82
83
# File 'lib/comfortable_mexican_sofa/seeds.rb', line 79

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

Instance Attribute Details

#fromObject

Returns the value of attribute from


74
75
76
# File 'lib/comfortable_mexican_sofa/seeds.rb', line 74

def from
  @from
end

#pathObject

Returns the value of attribute path


74
75
76
# File 'lib/comfortable_mexican_sofa/seeds.rb', line 74

def path
  @path
end

#siteObject

Returns the value of attribute site


74
75
76
# File 'lib/comfortable_mexican_sofa/seeds.rb', line 74

def site
  @site
end

#toObject

Returns the value of attribute to


74
75
76
# File 'lib/comfortable_mexican_sofa/seeds.rb', line 74

def to
  @to
end

Instance Method Details

#export!(classes = nil) ⇒ Object

if passed nil will use default seed classes


86
87
88
89
90
91
92
# File 'lib/comfortable_mexican_sofa/seeds.rb', line 86

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