lib/brief/model.rb in brief-1.6.1 vs lib/brief/model.rb in brief-1.7.0
- old
+ new
@@ -27,10 +27,18 @@
Brief::Model.classes << self
end
module AccessorMethods
+ def document_title
+ data.try(:[], :title) ||
+ extracted_content_data.try(:title) ||
+ path.basename.to_s
+ .gsub(/\.html.md/,'')
+ .gsub(/\.md/,'')
+ end
+
def data
document.data || {}.to_mash
end
def content
@@ -108,9 +116,13 @@
end
module ClassMethods
def ==(other)
type_alias && type_alias == other.type_alias
+ end
+
+ def accessor_property_names
+ (definition.content_schema.attributes.keys + definition.metadata_schema.keys).uniq
end
def to_schema
{
schema: {