Sha256: 3042ea1c2ad34eecf8d336fce15a17130add48694af3a3544bf959d9678f20cf

Contents?: true

Size: 758 Bytes

Versions: 2

Compression:

Stored size: 758 Bytes

Contents

module Rack
  module Blogengine
    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.1.8 lib/rack/blogengine/document.rb
rack-blogengine-0.1.7 lib/rack/blogengine/document.rb