Sha256: f3869cd10e820884ac2533b3e7ea6e14ba47ea518dd6cd9cc8bea9c4a82ad589

Contents?: true

Size: 872 Bytes

Versions: 2

Compression:

Stored size: 872 Bytes

Contents

module Rack
  module Blogengine
    # 
    # Document Class
    # Contains attributes path, html, title, date
    # 
    # @author [benny]
    # 
    class Document
      attr_accessor :path, :html, :title, :date

      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

      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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rack-blogengine-0.2.0 lib/rack/blogengine/document.rb
rack-blogengine-0.1.9 lib/rack/blogengine/document.rb