Class: Mexican::States::SeedGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Mexican::States::SeedGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/mexican/states/seed_generator.rb
Overview
Seed generator class
Instance Method Summary collapse
Instance Method Details
#seed_models ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/generators/mexican/states/seed_generator.rb', line 18 def seed_models root = File. '../../../../support/', __FILE__ Dir.glob(root + '/*.csv') do |rb_file| state = rb_file.scan(/[á-óa-zA-Z]+[_[á-óa-zA-Z]+]*/)[-3] if states.empty? || states.include?(state) puts "#{Rainbow('Installing').red} #{Rainbow(state).green}" save_datum(File.join(rb_file)) end end end |