class Rack::Blogengine::Document
Document
Class Contains attributes path, html, title, date
@author [benny]
Attributes
date[RW]
html[RW]
path[RW]
title[RW]
Public Instance Methods
exec_content_operator(documents, target)
click to toggle source
Executes Content Operators and returns modified html @param [Array] documents [Array of Documents available in operators] @param [String] target [Target for executing Operator
from Targetfolder]
@return [String] @html [Sets @html to modified html from operator]
# File lib/rack/blogengine/document.rb, line 29 def exec_content_operator(documents, target) @html.scan(/\{\%(.*?)\%\}/).each do |contentoperator| contentoperator = contentoperator[0].strip.to_sym operator = Operator.new(target) operatorhtml = operator.send(contentoperator, documents, @html) @html['{% ' + contentoperator.to_s + ' %}'] = operatorhtml end end
to_hash()
click to toggle source
Converts Rack::Blogengine::Docuemnt to Hash @return [Hash] DocumentHashed [Document in Hash Presentation contains :path and :html]
# File lib/rack/blogengine/document.rb, line 14 def to_hash hash = {} instance_variables.each do |var| unless var.to_s == '@title' || var.to_s == '@date' hash[var.to_s.delete('@').to_sym] = instance_variable_get(var) end end hash end