class Jekyll::Commands::ComposeCommand::ComposeCommandFileInfo
Public Class Methods
new(params)
click to toggle source
# File lib/jekyll/commands/compose.rb, line 69 def initialize(params) @params = params @collection = params.collection end
Public Instance Methods
content(custom_front_matter = {})
click to toggle source
Calls superclass method
Jekyll::Compose::FileInfo#content
# File lib/jekyll/commands/compose.rb, line 91 def content(custom_front_matter = {}) default_front_matter = front_matter_defaults_for(@collection) custom_front_matter.merge!(default_front_matter) if default_front_matter.is_a?(Hash) super({ "date" => time_stamp }.merge!(custom_front_matter)) end
file_name()
click to toggle source
Calls superclass method
Jekyll::Compose::FileInfo#file_name
# File lib/jekyll/commands/compose.rb, line 87 def file_name @collection == "posts" ? "#{date_stamp}-#{super}" : super end
path()
click to toggle source
# File lib/jekyll/commands/compose.rb, line 83 def path File.join("_#{@collection}", file_name) end
resource_type()
click to toggle source
# File lib/jekyll/commands/compose.rb, line 74 def resource_type case @collection when "posts" then "post" when "drafts" then "draft" else "file" end end
Private Instance Methods
date_stamp()
click to toggle source
# File lib/jekyll/commands/compose.rb, line 100 def date_stamp @params.date.strftime(Jekyll::Compose::DEFAULT_DATESTAMP_FORMAT) end
time_stamp()
click to toggle source
# File lib/jekyll/commands/compose.rb, line 104 def time_stamp @params.date.strftime(Jekyll::Compose::DEFAULT_TIMESTAMP_FORMAT) end