Class: Mddb::Generators::Molecule

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/mddb/generators/molecule.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



8
9
10
# File 'lib/mddb/generators/molecule.rb', line 8

def self.source_root
  File.expand_path('../../templates', __FILE__)
end

Instance Method Details

#moleculeObject



12
13
14
15
16
17
18
# File 'lib/mddb/generators/molecule.rb', line 12

def molecule
  template "molecule.rb.tt", "models/molecules/#{name}.rb"
  inject_into_class "models/frame.rb", Frame do 
    "  many :#{name.pluralize}, :class_name => '#{name.capitalize}'\n"
  end
  template "spec/molecule_spec.rb.tt", "spec/molecules/#{name}_spec.rb"
end