class ProjectsGenerator
Attributes
Public Class Methods
new(author, title, date)
click to toggle source
Calls superclass method
TempGenerator::new
# File lib/cosi-temp/projects-generator.rb, line 4 def initialize(author, title, date) super(date) @title = title @author = author @filename = gen_filename @file_array = create_file end
Private Instance Methods
create_file()
click to toggle source
# File lib/cosi-temp/projects-generator.rb, line 18 def create_file array = ["---\n", "layout: post\n", "title: #{@title}\n", "author: #{@author}\n", "---\n"] array end
gen_filename()
click to toggle source
# File lib/cosi-temp/projects-generator.rb, line 14 def gen_filename "#{@date.strftime('%Y-%m-%d')}-#{@title.split.map{|word| word.downcase}.join('-')}.md" end