Module: Brief::Document::FrontMatter

Extended by:
ActiveSupport::Concern
Included in:
Brief::Document
Defined in:
lib/brief/document/front_matter.rb

Instance Method Summary collapse

Instance Method Details

#data=(attributes) ⇒ Object



10
11
12
# File 'lib/brief/document/front_matter.rb', line 10

def data= attributes
  self.frontmatter= attributes
end

#frontmatterObject



14
15
16
17
18
# File 'lib/brief/document/front_matter.rb', line 14

def frontmatter
  (@frontmatter || load_frontmatter).tap do |d|
    d[:type] ||= parent_folder_name && parent_folder_name.to_s.singularize if parent_folder_name && parent_folder_name.length > 0
  end
end

#frontmatter=(attributes) ⇒ Object



6
7
8
# File 'lib/brief/document/front_matter.rb', line 6

def frontmatter= attributes
  @frontmatter = attributes
end

#frontmatter_line_countObject



20
21
22
# File 'lib/brief/document/front_matter.rb', line 20

def frontmatter_line_count
  (@raw_frontmatter && @raw_frontmatter.lines.count) || 0
end