Class: Jekyll::Commands::RenameMovementInfo
- Inherits:
-
Jekyll::Compose::FileInfo
- Object
- Jekyll::Compose::FileInfo
- Jekyll::Commands::RenameMovementInfo
- Defined in:
- lib/jekyll/commands/rename.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #from ⇒ Object
- #front_matter(data) ⇒ Object
-
#initialize(params) ⇒ RenameMovementInfo
constructor
A new instance of RenameMovementInfo.
- #resource_type ⇒ Object
- #to ⇒ Object
Methods inherited from Jekyll::Compose::FileInfo
Constructor Details
#initialize(params) ⇒ RenameMovementInfo
Returns a new instance of RenameMovementInfo.
94 95 96 |
# File 'lib/jekyll/commands/rename.rb', line 94 def initialize(params) @params = params end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
93 94 95 |
# File 'lib/jekyll/commands/rename.rb', line 93 def params @params end |
Instance Method Details
#from ⇒ Object
98 99 100 |
# File 'lib/jekyll/commands/rename.rb', line 98 def from params.path end |
#front_matter(data) ⇒ Object
120 121 122 123 124 |
# 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 ⇒ Object
102 103 104 105 106 107 108 109 110 |
# File 'lib/jekyll/commands/rename.rb', line 102 def resource_type if @params.post? "post" elsif @params.draft? "draft" else "file" end end |
#to ⇒ Object
112 113 114 115 116 117 118 |
# 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 |