class Penman::SeedFileGenerator

Attributes

file_name[R]
seed_code[R]
timestamp[R]

Public Class Methods

new(file_name, timestamp, seed_code) click to toggle source
# File lib/penman/seed_file_generator.rb, line 7
def initialize(file_name, timestamp, seed_code)
  @seed_code = seed_code
  @file_name = file_name
  @timestamp = timestamp
end

Public Instance Methods

write_seed() click to toggle source
# File lib/penman/seed_file_generator.rb, line 13
def write_seed
  erb = ERB.new(File.read(Penman.config.seed_template_file))
  seed_file_name = "#{@timestamp}_#{@file_name}.rb"
  full_seed_file_path = File.join(Penman.config.seed_path, seed_file_name)
  IO.write(full_seed_file_path, erb.result(binding))

  if Penman.config.after_generate.present?
    Penman.config.after_generate.call(@timestamp, @file_name)
  end

  full_seed_file_path
end