Class: Jekyll::Compose::FileInfo
- Inherits:
-
Object
- Object
- Jekyll::Compose::FileInfo
- Defined in:
- lib/jekyll-compose/file_info.rb
Direct Known Subclasses
Jekyll::Commands::ComposeCommand::ComposeCommandFileInfo, Jekyll::Commands::Draft::DraftFileInfo, Jekyll::Commands::Page::PageFileInfo, Jekyll::Commands::Post::PostFileInfo, Jekyll::Commands::RenameMovementInfo
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #content(custom_front_matter = {}) ⇒ Object
- #file_name ⇒ Object
-
#initialize(params) ⇒ FileInfo
constructor
A new instance of FileInfo.
Constructor Details
#initialize(params) ⇒ FileInfo
Returns a new instance of FileInfo.
7 8 9 |
# File 'lib/jekyll-compose/file_info.rb', line 7 def initialize(params) @params = params end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
6 7 8 |
# File 'lib/jekyll-compose/file_info.rb', line 6 def params @params end |
Instance Method Details
#content(custom_front_matter = {}) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/jekyll-compose/file_info.rb', line 16 def content(custom_front_matter = {}) front_matter = YAML.dump({ "layout" => params.layout, "title" => params.title, }.merge(custom_front_matter)) front_matter + "---\n" end |
#file_name ⇒ Object
11 12 13 14 |
# File 'lib/jekyll-compose/file_info.rb', line 11 def file_name name = Jekyll::Utils.slugify params.title "#{name}.#{params.type}" end |