lib/brief/document.rb in brief-1.8.4 vs lib/brief/document.rb in brief-1.8.5
- old
+ new
@@ -2,11 +2,11 @@
class Document
include Brief::Document::Rendering
include Brief::Document::FrontMatter
include Brief::Document::Templating
- attr_accessor :path, :content, :frontmatter, :raw_content
+ attr_accessor :path, :content, :frontmatter, :raw_content, :options
def document
self
end
@@ -212,9 +212,13 @@
raise 'Could not determine the model class to use for this document. Specify the type, or put it in a folder that maps to the correct type.'
end
end
def document_type
+ options.fetch(:type) { document_type! }
+ end
+
+ def document_type!
existing = data && data.type
return existing if existing
parent_folder_name.try(:singularize)
end