Method: Brief::Model::ClassMethods#generate_template_content_from
- Defined in:
- lib/brief/model.rb
#generate_template_content_from(object, include_frontmatter = true) ⇒ Object
202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/brief/model.rb', line 202 def generate_template_content_from(object, include_frontmatter = true) @erb ||= ERB.new(template_body) content = @erb.result(binding) frontmatter = object.slice(*attribute_names) base = '' base += frontmatter.to_hash.to_yaml + "---\n" if include_frontmatter base += content base end |