class Jekyll::Commands::RenameMovementInfo
Attributes
params[R]
Public Class Methods
new(params)
click to toggle source
# File lib/jekyll/commands/rename.rb, line 94 def initialize(params) @params = params end
Public Instance Methods
from()
click to toggle source
# File lib/jekyll/commands/rename.rb, line 98 def from params.path end
front_matter(data)
click to toggle source
# File lib/jekyll/commands/rename.rb, line 120 def front_matter(data) data["title"] = params.title data["date"] = time_stamp if @params.touch? data end
resource_type()
click to toggle source
# File lib/jekyll/commands/rename.rb, line 102 def resource_type if @params.post? "post" elsif @params.draft? "draft" else "file" end end
to()
click to toggle source
# File lib/jekyll/commands/rename.rb, line 112 def to if @params.post? File.join(@params.dirname, "#{date_stamp}-#{file_name}") else File.join(@params.dirname, file_name) end end
Private Instance Methods
date_stamp()
click to toggle source
# File lib/jekyll/commands/rename.rb, line 128 def date_stamp if @params.touch? @params.date.strftime Jekyll::Compose::DEFAULT_DATESTAMP_FORMAT else @params.date_from_filename.strftime Jekyll::Compose::DEFAULT_DATESTAMP_FORMAT end end
time_stamp()
click to toggle source
# File lib/jekyll/commands/rename.rb, line 136 def time_stamp @params.date.strftime Jekyll::Compose::DEFAULT_TIMESTAMP_FORMAT end