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