Class: Kryo::Generators::PostGenerator
- Defined in:
- lib/kryo/generators/post/post_generator.rb
Overview
Used to generate a basic post
Constant Summary collapse
- VALID_TYPES =
%w{markdown}.freeze
Class Method Summary collapse
Methods inherited from Base
Class Method Details
.invoke(title, type = 'markdown') ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/kryo/generators/post/post_generator.rb', line 12 def self.invoke title, type='markdown' directory = File.join(FileUtils.pwd, 'source', 'posts') date = DateTime.now name = [date.strftime("%Y-%m-%d"),title.gsub(/\s+/,'-')].join('-') name = [name, type].join('.').downcase create "post/templates/post.#{type}", directory, name: name do @title = title end end |