Class: Bunto::Compose::FileInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/bunto-compose/file_info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#paramsObject (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

#contentObject



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_nameObject



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