Class: Jekyll::Commands::ComposeCommand::ComposeCommandFileInfo
- Inherits:
-
Jekyll::Compose::FileInfo
- Object
- Jekyll::Compose::FileInfo
- Jekyll::Commands::ComposeCommand::ComposeCommandFileInfo
- Defined in:
- lib/jekyll/commands/compose.rb
Instance Attribute Summary
Attributes inherited from Jekyll::Compose::FileInfo
Instance Method Summary collapse
- #content(custom_front_matter = {}) ⇒ Object
- #file_name ⇒ Object
-
#initialize(params) ⇒ ComposeCommandFileInfo
constructor
A new instance of ComposeCommandFileInfo.
- #path ⇒ Object
- #resource_type ⇒ Object
Constructor Details
#initialize(params) ⇒ ComposeCommandFileInfo
Returns a new instance of ComposeCommandFileInfo.
69 70 71 72 |
# File 'lib/jekyll/commands/compose.rb', line 69 def initialize(params) @params = params @collection = params.collection end |
Instance Method Details
#content(custom_front_matter = {}) ⇒ Object
91 92 93 94 95 96 |
# 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 ⇒ Object
87 88 89 |
# File 'lib/jekyll/commands/compose.rb', line 87 def file_name @collection == "posts" ? "#{date_stamp}-#{super}" : super end |
#path ⇒ Object
83 84 85 |
# File 'lib/jekyll/commands/compose.rb', line 83 def path File.join("_#{@collection}", file_name) end |
#resource_type ⇒ Object
74 75 76 77 78 79 80 81 |
# 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 |